extras/audio: Preventing a crash on sound with no data
authorJerome St-Louis <jerome@ecere.com>
Sat, 19 Apr 2014 13:31:51 +0000 (09:31 -0400)
committerJerome St-Louis <jerome@ecere.com>
Sat, 19 Apr 2014 13:31:51 +0000 (09:31 -0400)
extras/audio/mixer.ec

index 664ab24..2fe229c 100644 (file)
@@ -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()