* Fixed issue where an ogre3d animation with no tracks would load, but cause a NPE when loaded again from J3O

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9317 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
Sha..rd 13 years ago
parent ad01d36915
commit c8fa79fbd6
  1. 10
      engine/src/core/com/jme3/animation/Animation.java

@ -168,7 +168,13 @@ public class Animation implements Savable, Cloneable {
length = in.readFloat("length", 0f);
Savable[] arr = in.readSavableArray("tracks", null);
tracks = new Track[arr.length];
System.arraycopy(arr, 0, tracks, 0, arr.length);
if (arr != null) {
// NOTE: Backward compat only .. Some animations have no
// tracks set at all even though it makes no sense.
// Since there's a null check in setTime(),
// its only appropriate that the check is made here as well.
tracks = new Track[arr.length];
System.arraycopy(arr, 0, tracks, 0, arr.length);
}
}
}

Loading…
Cancel
Save