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
3.0
Kae..pl 12 years ago
parent 69205a679b
commit 2ace208225
  1. 5
      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

Loading…
Cancel
Save