createSingleBoxShape NullPointerException

Hey guys,



I’m getting this error:



[java]Exception in thread “Thread-5” java.lang.NullPointerException

at com.jme3.bullet.util.CollisionShapeFactory.createSingleBoxShape(CollisionShapeFactory.java:229)

at com.jme3.bullet.util.CollisionShapeFactory.createCompoundShape(CollisionShapeFactory.java:123)

at com.jme3.bullet.util.CollisionShapeFactory.createCompoundShape(CollisionShapeFactory.java:134)

at com.jme3.bullet.util.CollisionShapeFactory.createBoxCompoundShape(CollisionShapeFactory.java:153)

at com.jme3.bullet.util.CollisionShapeFactory.createBoxShape(CollisionShapeFactory.java:199)

at Game.Physics.BasicPhysics.CreateShape(BasicPhysics.java:68)

at Game.TerrainGeneration.PolygonizationThread.run(PolygonizationThread.java:157)

at java.lang.Thread.run(Thread.java:722)[/java]



… from this call:



[java] public void CreateShape() {

// check if makeFrom is valid

if( makeFrom != null && makeFrom instanceof Node ) {

Node mf = (Node)makeFrom;

List<Spatial> Children = mf.getChildren();

for(int i=0;i<Children.size();i++) {

if( Children.get(i) == null ) {

// null child found!

return;

}

}

}

switch( shapeType ) {

case CTYPE.GEOBOX:

if( makeFrom != null ) {

myShape = CollisionShapeFactory.createBoxShape(makeFrom);

}

break;[/java]



I’m trying to see where the NullPointerException is coming from by checking makeFrom before making the call to createBoxShape… but even with all those null checks, I still get the exception occasionally. I don’t think it is a threading problem, since I only set makeFrom during the construction of this object, but I’m not really sure what is going on :frowning: Any suggestions?