Nifty NPE at de.lessvoid.nifty.screen.Screen.forwardMouseEventToLayers

Hi there,

we changed to the new JME 3 SDK with all its libraries. For that i have to change NiftyTab to Tab and Tabs to TabGroup. This worked out fine.

But if i move the mouse while the Screen is loading, the correct Screen is showing but just for about 0,2 Sec. After that everything crashs with a NPE:

java.lang.NullPointerException: null
at de.lessvoid.nifty.screen.Screen.forwardMouseEventToLayers( ~[nifty.jar:na]
at de.lessvoid.nifty.screen.Screen.mouseEvent( ~[nifty.jar:na]
at de.lessvoid.nifty.Nifty.forwardMouseEventToScreen( ~[nifty.jar:na]
at de.lessvoid.nifty.Nifty.access$1600( ~[nifty.jar:na]
at de.lessvoid.nifty.Nifty$NiftyInputConsumerImpl.processEvent( ~[nifty.jar:na]
at de.lessvoid.nifty.Nifty$NiftyInputConsumerImpl.processMouseEvent(
at com.jme3.niftygui.InputSystemJme.handleMouseEvent(
at com.jme3.niftygui.InputSystemJme.onMouseButtonEventQueued(
at com.jme3.niftygui.InputSystemJme.forwardEvents( ~[jME3-niftygui.jar:na]
at de.lessvoid.nifty.Nifty.update( ~[nifty.jar:na]
at com.jme3.niftygui.InputSystemJme.endInput( ~[jME3-niftygui.jar:na]
at com.jme3.input.InputManager.processQueue( ~[jME3-core.jar:na]
at com.jme3.input.InputManager.update( ~[jME3-core.jar:na]
at ~[jME3-core.jar:na]
at ~[jME3-core.jar:na]
at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(
at com.jme3.system.lwjgl.LwjglDisplay.runLoop( ~[jME3-lwjgl.jar:na]
at ~[na:1.7.0_11]

I red that this Exception was thrown in older Nifty Versions. But i use the new Version of JME3. Does anyone have any clues how to fix this problem.

If i don’t move the Mouse while the Screen is loading it works out find.

Thx for your efforts

Problem solved!

I think new NiftyJmeDisplay() was the Problem because it was the second initialisation of NiftyDisply.

To find the Controlls and Elements after addingXML and registering ScreenControlle I had to call
nifty.executeEndOfFrameElementAction (what ever this does :slight_smile: ).

Im having this same issue. When I move my mouse as I am switching between gui’s, the program crashes with a NPE. Where did you add nifty.executeEndOfFrameElementActions()? I tried adding that but it didnt seem to help. Can anyone help me out?