NullPointer in Element.canHandleInteraction()
Nifty GUI is a Java Library to create OpenGL based user interfaces.
Brought to you by:
void256
I'm using JMonkey 3 (trunk) with the nifty 1.3.2 sources. I originally encountered this problem with the JMonkey3 RC2 and the nifty version it ships.
My architecture uses a multithreaded model, but all operations regarding scene graph operations or nifty calls are passed to JMonkey's equeue() as a Callable. Addtionally, I tried calling everything from various threads what seems to make no difference.
However, the actual problem:
After calling disable() on a Button the InputManager Thread immediately throws a NullPointer exception in Element.canHandleInput(). The member field "screen" is null. A simple NullPointer check on screen and resp. returning false fixed the problem for me. I did not investigate further though.
There is no Element.canHandleInput() for me o_O
She screen member variable is set in element.bindControls(Screen) which in turn is called when the Screen is activated for the first time.
Although I believe that the check for null fixes your issue I don't think it fixes the actual issue which is probably related to some multithreaded issue in your case. So it would be great if you could do some further investigation!?