Fix crash on ESC press when no music is playing
authorTobias Markus <tobbi@mozilla-uk.org>
Thu, 19 Mar 2015 12:22:44 +0000 (13:22 +0100)
committerTobias Markus <tobbi@mozilla-uk.org>
Thu, 19 Mar 2015 12:22:44 +0000 (13:22 +0100)
src/audio/sound_manager.cpp

index ace96c1..3740d71 100644 (file)
@@ -303,6 +303,9 @@ SoundManager::play_music(const std::string& filename, bool fade)
 void
 SoundManager::pause_music(float fadetime)
 {
+  if(music_source == NULL || !music_source->playing())
+    return;
+
   if(fadetime > 0) {
     if(music_source
        && music_source->get_fade_state() != StreamSoundSource::FadingPause)
@@ -315,6 +318,9 @@ SoundManager::pause_music(float fadetime)
 void
 SoundManager::resume_music(float fadetime)
 {
+  if(music_source == NULL || !music_source->paused())
+    return;
+
   if(fadetime > 0) {
     if(music_source
        && music_source->get_fade_state() != StreamSoundSource::FadingResume)