From 2ace20822586546ff5e52f06152cb6176196d83e Mon Sep 17 00:00:00 2001 From: "Kae..pl" Date: Wed, 7 Nov 2012 16:07:48 +0000 Subject: [PATCH] Bugfix: fixed NPE error while getting subtarget of a constraint, not every constraint data have such field git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9973 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- .../jme3/scene/plugins/blender/constraints/Constraint.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/engine/src/blender/com/jme3/scene/plugins/blender/constraints/Constraint.java b/engine/src/blender/com/jme3/scene/plugins/blender/constraints/Constraint.java index af3748473..d7286be98 100644 --- a/engine/src/blender/com/jme3/scene/plugins/blender/constraints/Constraint.java +++ b/engine/src/blender/com/jme3/scene/plugins/blender/constraints/Constraint.java @@ -68,7 +68,10 @@ public abstract class Constraint { if(pTar!= null && pTar.isNotNull()) { this.targetOMA = pTar.getOldMemoryAddress(); this.targetSpace = Space.valueOf(((Number) constraintStructure.getFieldValue("tarspace")).byteValue()); - subtargetName = data.getFieldValue("subtarget").toString(); + Object subtargetValue = data.getFieldValue("subtarget"); + if(subtargetValue != null) {//not all constraint data have the subtarget field + subtargetName = subtargetValue.toString(); + } } } else { //Null constraint has no data, so create it here