Prevent previous music from playing when sound file couldn't be found
authorTobias Markus <tobbi@mozilla-uk.org>
Sun, 25 Aug 2013 10:19:51 +0000 (12:19 +0200)
committerTobias Markus <tobbi@mozilla-uk.org>
Sun, 25 Aug 2013 10:19:51 +0000 (12:19 +0200)
src/audio/sound_manager.cpp

index a7f32d8..89f86b2 100644 (file)
@@ -305,6 +305,8 @@ SoundManager::play_music(const std::string& filename, bool fade)
     music_source = newmusic.release();
   } catch(std::exception& e) {
     log_warning << "Couldn't play music file '" << filename << "': " << e.what() << std::endl;
+    // When this happens, previous music continued playing, stop it, just in case.
+    stop_music(0);
   }
 }