Nifty NullPointerException crash

Hello to everyone,

I ran jme3test.awt.TestCanvas and nifty crashes at :

  1. “switch look and feel”.
  2. “set size to 0”.

    SEVERE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]


    at de.lessvoid.nifty.Nifty.displayResolutionChanged(

    at de.lessvoid.nifty.Nifty.render(

    at com.jme3.niftygui.NiftyJmeDisplay.postQueue(

    at com.jme3.renderer.RenderManager.renderViewPort(

    at com.jme3.renderer.RenderManager.render(


    at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(

    at com.jme3.system.lwjgl.LwjglCanvas.runLoop(



  3. Also i noticed something strange, after using start/stop application, my init was called again, ambient light was recreated thus scene got brighter every time i used it.

Sounds like a bug in nifty. @void256: know anything about this?

About the start/stop issue, it assumes you’re not caching the scene since the entire application is restarted. If you store the scene somewhere then of course it will get corrupted each time the init is called

no, void256 knows nothing about that but when I suppose tralala uses Nifty 1.3 then the lines where it crashes is accessing the currentScreen instance variable of the Nifty instance. So could it be that this resolutionChanged() event is happening without having a valid screen yet?

jme3test.awt.TestCanvas in jMonkeyPlattform crashes here as well but I really don’t see any reference to Nifty in this example at all o_O

TestCanvas is actually loading another test internally. I think resolutionChanged() should still work even if there’s no screen

  1. yes i am using nifty 1.3.
  2. jme3test.awt.TestCanvas doesnt use nifty. I modified the code to add my application which has nifty.
  3. before pressing those 2 buttons “change look and feel”, “set size to 0” everything was running fine.

can you send your example in a zip or something for me to check? I don’t know what exactly you modified so it’s kinda hard to reproduce.

hello, i just returned,

replace method startApp() in jme3test.awt.TestCanvas with the following :


public static void startApp()



app.enqueue(new Callable<Void>()


public Void call()


if (app instanceof SimpleApplication)


SimpleApplication simpleApp = (SimpleApplication) app;


Nifty nifty;

NiftyJmeDisplay niftyDisplay = new NiftyJmeDisplay(app.getAssetManager(), app.getInputManager(), app.getAudioRenderer(), app.getGuiViewPort());

nifty = niftyDisplay.getNifty();

app.getGuiViewPort().addProcessor(niftyDisplay);// attach the nifty display to the gui view port as a processor


return null;