From: Tobias Markus Date: Thu, 19 Mar 2015 12:22:44 +0000 (+0100) Subject: Fix crash on ESC press when no music is playing X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=9f40a73e89c17a2862a1213343589c19eff42199;p=supertux.git Fix crash on ESC press when no music is playing --- diff --git a/src/audio/sound_manager.cpp b/src/audio/sound_manager.cpp index ace96c129..3740d71fe 100644 --- a/src/audio/sound_manager.cpp +++ b/src/audio/sound_manager.cpp @@ -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)