From 89617347fe3a8580f67529d175f4f47ff473d4c6 Mon Sep 17 00:00:00 2001 From: cosmosninja Date: Sat, 10 May 2008 23:29:04 +0000 Subject: [PATCH] Fixed music crash bug git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@1849 178a84e3-b1eb-0310-8ba1-8eac791a3b58 --- src/music_information.cpp | 10 +++++++++- src/music_ogg.cpp | 1 - 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/music_information.cpp b/src/music_information.cpp index a44953f93..5bbcb513a 100755 --- a/src/music_information.cpp +++ b/src/music_information.cpp @@ -170,6 +170,8 @@ void MusicInformation::update(float dt) switch(m_mode) { case SOUND_FADING: { + if ( m_normal_music == NULL || m_fast_music == NULL ) break; + m_time_since_faster +=dt; if(m_time_since_faster>=m_faster_time) { @@ -184,10 +186,12 @@ void MusicInformation::update(float dt) break; } case SOUND_FASTER: { + if ( m_normal_music == NULL ) break; + m_time_since_faster +=dt; if(m_time_since_faster>=m_faster_time) { - // Once the pitch is adjusted, just switch back to normal + // Once the pitch is adjusted, just switch back to normal // mode. We can't switch to fast music mode, since this would // play m_fast_music, which isn't available. m_mode=SOUND_NORMAL; @@ -199,9 +203,13 @@ void MusicInformation::update(float dt) break; } case SOUND_NORMAL: + if ( m_normal_music == NULL ) break; + m_normal_music->update(); break; case SOUND_FAST: + if ( m_fast_music == NULL ) break; + m_fast_music->update(); break; } // switch diff --git a/src/music_ogg.cpp b/src/music_ogg.cpp index da28be93b..42f2d556b 100644 --- a/src/music_ogg.cpp +++ b/src/music_ogg.cpp @@ -60,7 +60,6 @@ bool MusicOggStream::load(const std::string& filename) return false; } - //m_fileName = file_manager->getMusicFile(filename); m_fileName = filename; if(m_fileName=="") return false;