AnimationTrack null checked the animation channel in onStop, onPause and setLoopMode to avoid NPE

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9288 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
rem..om 13 years ago
parent bc0207f1fc
commit c3ed68cfbb
  1. 20
      engine/src/core/com/jme3/cinematic/events/AnimationTrack.java

@ -146,18 +146,16 @@ public class AnimationTrack extends AbstractCinematicEvent {
channel.setSpeed(speed);
channel.setLoopMode(loopMode);
channel.setTime(time);
}
}
}
@Override
public void setSpeed(float speed) {
super.setSpeed(speed);
if(channel!=null){
if (channel != null) {
channel.setSpeed(speed);
}
}
@Override
public void onUpdate(float tpf) {
@ -165,19 +163,25 @@ public class AnimationTrack extends AbstractCinematicEvent {
@Override
public void onStop() {
channel.setTime(0);
channel.reset(false);
if (channel != null) {
channel.setTime(0);
channel.reset(false);
}
}
@Override
public void onPause() {
channel.getControl().setEnabled(false);
if (channel != null) {
channel.getControl().setEnabled(false);
}
}
@Override
public void setLoopMode(LoopMode loopMode) {
super.setLoopMode(loopMode);
channel.setLoopMode(loopMode);
if (channel != null) {
channel.setLoopMode(loopMode);
}
}
@Override

Loading…
Cancel
Save