Hello Guest

[FIXED] java.lang.NullPointerException - how to fix this?

  • 4 Replies
  • 26477 Views
[FIXED] java.lang.NullPointerException - how to fix this?
« on: October 19, 2011, 15:48:16 »
Hi,
previously I programmed games in NetBeans. Than I changed an application to Eclipse. I installed LWJGL and copy (from NetBeans to Eclipse) my code, but after run my game, Eclipse displays error:
Quote
Exception in thread "main" java.lang.NullPointerException
   at org.lwjgl.MemoryUtil.getAddress(MemoryUtil.java:126)
   at org.lwjgl.openal.ALC11.alcCaptureOpenDevice(ALC11.java:96)
   at org.lwjgl.test.openal.ALCCaptureTest.execute(ALCCaptureTest.java:92)
   at org.lwjgl.test.openal.ALCCaptureTest.main(ALCCaptureTest.java:151)
Do you know how to fix this error? What I should do?
Sorry for mistakes in English. I do not speak English very well.

Re: java.lang.NullPointerException - how to fix this?
« Reply #1 on: October 20, 2011, 02:10:50 »
That kind of error is caused when you try to call a function or access data from a null pointer (a class that is null).  It's 100% code specific, so we'll need to see some code.

The following code would throw a java.lang.NullPointerException:

Quote
Class myclass = null;

myclass.doSomething();

*

Offline Matzon

  • *****
  • 2242
Re: java.lang.NullPointerException - how to fix this?
« Reply #2 on: October 20, 2011, 07:32:56 »
confirmin... something with spasis utf8 changes is breaking alc, which is encoding the return string
« Last Edit: October 20, 2011, 07:53:17 by Matzon »

*

Offline Matzon

  • *****
  • 2242
Re: java.lang.NullPointerException - how to fix this?
« Reply #3 on: October 20, 2011, 07:48:05 »
right, so the generator doesn't like passing in NULL to MemoryUtil.getAddress(buffer) :) need to do a 'long address = buffer == null ? 0 : MemoryUtil.getAddress(buffer);' thingy ...
Unless someone looks into this soon - I wont be able to until tonight.

*

Offline Matzon

  • *****
  • 2242
Re: java.lang.NullPointerException - how to fix this?
« Reply #4 on: October 20, 2011, 07:58:08 »
fixed in nightly - not a generator issue, just the utf8 changes