Browse files

Check for possible null reference in Sfx

  • Loading branch information...
1 parent 957b6fa commit 7a182c9abb9a8b302d2b277558e1072278640d4d @Draknek Draknek committed Mar 28, 2011
Showing with 2 additions and 2 deletions.
  1. +2 −2 net/flashpunk/Sfx.as
View
4 net/flashpunk/Sfx.as
@@ -44,7 +44,7 @@
_vol = _transform.volume = vol < 0 ? 0 : vol;
_pan = _transform.pan = pan < -1 ? -1 : (pan > 1 ? 1 : pan);
_channel = _sound.play(0, 0, _transform);
- _channel.addEventListener(Event.SOUND_COMPLETE, onComplete);
+ if (_channel) _channel.addEventListener(Event.SOUND_COMPLETE, onComplete);
_looping = false;
_position = 0;
}
@@ -80,7 +80,7 @@
public function resume():void
{
_channel = _sound.play(_position, 0, _transform);
- _channel.addEventListener(Event.SOUND_COMPLETE, onComplete);
+ if (_channel) _channel.addEventListener(Event.SOUND_COMPLETE, onComplete);
_position = 0;
}

0 comments on commit 7a182c9

Please sign in to comment.