NullPointerException in LWJGLRenderer.draw

Hi everyone,

I get this exception not every time I start my application but about every second to third time.

Due to that erratic behaviour I assume it is a threading problem but I have been unable to debug into it.

As you can see I use an extention of StandardGame. I use several GameStates one of which is a JMEDesktopState.

Any help or hints is appreciated.

18:12:41 [12]>uncaughtException() - SCHWERWIEGEND: Main game loop broken by uncaught exception
   at com.jme.renderer.lwjgl.LWJGLRenderer.draw(
   at com.jme.scene.batch.TriangleBatch.draw(
   at com.jme.renderer.RenderQueue.renderOrthoBucket(
   at com.jme.renderer.RenderQueue.renderBuckets(
   at com.jme.renderer.Renderer.renderQueue(
   at com.jme.renderer.lwjgl.LWJGLRenderer.displayBackBuffer(

Don't modify the scenegraph while it is being updated or rendered (your case). In StandardGame you need to use locking. I never used StandardGame myself, so maybe someone else can tell you the exact code lines required for locking if you do not know them.

Check the wiki:

You need to either call game.lock(); game.unlock(); or use the GameQueue to insert code into the GL-thread

Thanks a lot that should have fixed my problem!