From: Jerome St-Louis Date: Sat, 19 Apr 2014 13:31:51 +0000 (-0400) Subject: extras/audio: Preventing a crash on sound with no data X-Git-Tag: 0.44.10PR1~377 X-Git-Url: http://ecere.com/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f7ceb245207a127a1107c6b9092acebb5424eb15;p=sdk extras/audio: Preventing a crash on sound with no data --- diff --git a/extras/audio/mixer.ec b/extras/audio/mixer.ec index 664ab24..2fe229c 100644 --- a/extras/audio/mixer.ec +++ b/extras/audio/mixer.ec @@ -276,12 +276,16 @@ public: Voice Play(Sound sound, double volume, double balance, double pitch) { - Voice voice { sound, volume, balance, pitch }; - mutex.Wait(); - voices.Add(voice); - incref voice; - mutex.Release(); - return voice; + if(sound && sound.data) + { + Voice voice { sound, volume, balance, pitch }; + mutex.Wait(); + voices.Add(voice); + incref voice; + mutex.Release(); + return voice; + } + return null; } void Wait()