This is pretty suspicious stuff. Most of the time, the program runs fine. But sometimes, we get the following stacktrace (given in context - not that it matters).
22-jun-2007 14:08:30 com.jme.util.lwjgl.LWJGLTimer <init>
INFO: Timer resolution: 1000 ticks per second
22-jun-2007 14:08:30 com.jmex.game.DefaultUncaughtExceptionHandler uncaughtException
SEVERE: Main game loop broken by uncaught exception
java.lang.NullPointerException
at com.jmex.sound.openAL.SoundSystem.update(Unknown Source)
at com.jmex.game.StandardGame.update(Unknown Source)
at com.jmex.game.StandardGame.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
22-jun-2007 14:08:30 com.jmex.sound.openAL.scene.SoundNode <init>
INFO: Node created.
On another run, the position might be slightly different (below the SoundNode constructor, for example). So, this sounds a damn lot like a racing condition of some sorts. I started digging at the sources and the only suspicious line I could find is line 202 in com.jmex.sound.openAL.SoundSystem.java
nodes[nodeName].updateWorldData(time);
Proposed patch:
Index: src/com/jmex/sound/openAL/SoundSystem.java
===================================================================
RCS file: /cvs/jme/src/com/jmex/sound/openAL/SoundSystem.java,v
retrieving revision 1.15
diff -u -r1.15 SoundSystem.java
--- src/com/jmex/sound/openAL/SoundSystem.java 6 Mar 2007 15:30:00 -0000 1.15
+++ src/com/jmex/sound/openAL/SoundSystem.java 22 Jun 2007 12:26:00 -0000
@@ -199,7 +199,8 @@
public static void update(int nodeName, float time){
if(nodes==null) return;
if(nodeName<0 || nodeName>=nodes.length) return;
- nodes[nodeName].updateWorldData(time);
+ if(nodes[nodeName] != null)
+ nodes[nodeName].updateWorldData(time);
updateListener();
}
Because of the random nature of this crash, I can't tell for sure this solves it. I haven't had any problems in the couple of runs I did with patched sources, I'll tell you if I have. And perhaps the root of the problem is deeper than this. Have fun figuring it out.