Przeglądaj źródła

TestAttachDriver: don't remove the SliderJoint more than once (#1560)

Stephen Gold 4 lat temu
rodzic
commit
fb5529fbf9

+ 5 - 2
jme3-examples/src/main/java/jme3test/bullet/TestAttachDriver.java

@@ -275,8 +275,11 @@ public class TestAttachDriver extends SimpleApplication implements ActionListene
             }
         } else if (binding.equals("Space")) {
             if (value) {
-                getPhysicsSpace().remove(slider);
-                slider.destroy();
+                if (slider != null) {
+                    getPhysicsSpace().remove(slider);
+                    slider.destroy();
+                    slider = null;
+                }
                 vehicle.applyImpulse(jumpForce, Vector3f.ZERO);
             }
         } else if (binding.equals("Reset")) {