From 9f7b27351741f355304aef27653f119bdf4df3d4 Mon Sep 17 00:00:00 2001 From: "nor..67" Date: Tue, 5 Feb 2013 19:28:10 +0000 Subject: [PATCH] - fix possible NPE in BulletAppState git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10344 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- .../src/bullet-common/com/jme3/bullet/BulletAppState.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/engine/src/bullet-common/com/jme3/bullet/BulletAppState.java b/engine/src/bullet-common/com/jme3/bullet/BulletAppState.java index 61165c3dd..cdf93479d 100644 --- a/engine/src/bullet-common/com/jme3/bullet/BulletAppState.java +++ b/engine/src/bullet-common/com/jme3/bullet/BulletAppState.java @@ -212,14 +212,16 @@ public class BulletAppState implements AppState, PhysicsTickListener { } public void update(float tpf) { - if (debugEnabled && debugAppState == null) { + if (debugEnabled && debugAppState == null && pSpace != null) { debugAppState = new BulletDebugAppState(pSpace); stateManager.attach(debugAppState); pSpace.enableDebug(app.getAssetManager()); } else if (!debugEnabled && debugAppState != null) { stateManager.detach(debugAppState); debugAppState = null; - pSpace.enableDebug(null); + if (pSpace != null) { + pSpace.enableDebug(null); + } } //TODO: remove when deprecation of PhysicsSpace.enableDebug is through if (pSpace.getDebugManager() != null && !debugEnabled) {