From 54313302beb413ee03fa3e95760f3eaecbb88b43 Mon Sep 17 00:00:00 2001 From: "rem..om" Date: Fri, 5 Oct 2012 21:12:40 +0000 Subject: [PATCH] EffectTrack : fixed isssue where an IllegalArgumentExceptio was wrongly raised when removing the spatial from the kill particle control git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9842 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- .../src/core/com/jme3/animation/EffectTrack.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/engine/src/core/com/jme3/animation/EffectTrack.java b/engine/src/core/com/jme3/animation/EffectTrack.java index 061382414..bd3df8c1e 100644 --- a/engine/src/core/com/jme3/animation/EffectTrack.java +++ b/engine/src/core/com/jme3/animation/EffectTrack.java @@ -88,11 +88,14 @@ public class EffectTrack implements ClonableTrack { @Override public void setSpatial(Spatial spatial) { super.setSpatial(spatial); - if(spatial instanceof ParticleEmitter){ - emitter = (ParticleEmitter)spatial; - }else{ - throw new IllegalArgumentException("KillParticleEmitter can only ba attached to ParticleEmitter"); - } + if (spatial != null) { + if (spatial instanceof ParticleEmitter) { + emitter = (ParticleEmitter) spatial; + } else { + throw new IllegalArgumentException("KillParticleEmitter can only ba attached to ParticleEmitter"); + } + } + } @@ -371,7 +374,7 @@ public class EffectTrack implements ClonableTrack { emitter = (ParticleEmitter) in.readSavable("emitter", null); emitter.setParticlesPerSec(0); //if the emitter was saved with a KillParticleControl we remove it. - emitter.removeControl(KillParticleControl.class); +// emitter.removeControl(KillParticleControl.class); length = in.readFloat("length", length); startOffset = in.readFloat("startOffset", 0); }