diff --git a/src/states_screens/grand_prix_lose.cpp b/src/states_screens/grand_prix_lose.cpp index d70062a6b..3da4c7b07 100644 --- a/src/states_screens/grand_prix_lose.cpp +++ b/src/states_screens/grand_prix_lose.cpp @@ -56,7 +56,15 @@ GrandPrixLose::GrandPrixLose() : Screen("grand_prix_lose.stkgui") m_throttle_FPS = false; - m_music = music_manager->getMusicInformation(file_manager->getMusicFile("lose_theme.music")); + try + { + m_music = music_manager->getMusicInformation(file_manager->getMusicFile("lose_theme.music")); + } + catch (std::exception& e) + { + fprintf(stderr, "%s", e.what()); + m_music = NULL; + } } // GrandPrixLose // ------------------------------------------------------------------------------------- @@ -74,7 +82,6 @@ void GrandPrixLose::loadedFromFile() void GrandPrixLose::init() { Screen::init(); - //music_manager->startMusic(music_manager->getMusicInformation(file_manager->getMusicFile("lose_theme.music"))); m_phase = 1; m_sky_angle = 0.0f; diff --git a/src/states_screens/grand_prix_win.cpp b/src/states_screens/grand_prix_win.cpp index d750ef336..e9bc3a101 100644 --- a/src/states_screens/grand_prix_win.cpp +++ b/src/states_screens/grand_prix_win.cpp @@ -37,7 +37,15 @@ GrandPrixWin::GrandPrixWin() : Screen("grand_prix_win.stkgui") m_throttle_FPS = false; - m_music = music_manager->getMusicInformation(file_manager->getMusicFile("win_theme.music")); + try + { + m_music = music_manager->getMusicInformation(file_manager->getMusicFile("win_theme.music")); + } + catch (std::exception& e) + { + fprintf(stderr, "%s", e.what()); + m_music = NULL; + } } // GrandPrixWin // ------------------------------------------------------------------------------------- @@ -130,8 +138,6 @@ void GrandPrixWin::init() unlocked_label->add(); } - - //music_manager->startMusic(music_manager->getMusicInformation(file_manager->getMusicFile("win_theme.music"))); m_phase = 1; m_sky_angle = 0.0f; diff --git a/src/tracks/track.cpp b/src/tracks/track.cpp index 9aa9d897e..fdc08ee2e 100644 --- a/src/tracks/track.cpp +++ b/src/tracks/track.cpp @@ -263,18 +263,26 @@ void Track::getMusicInformation(std::vector& filenames, } if(!mi) { - std::string shared_name = file_manager->getMusicFile(filenames[i]); - if(shared_name!="") + try { - try + std::string shared_name = file_manager->getMusicFile(filenames[i]); + if(shared_name!="") { - mi = music_manager->getMusicInformation(shared_name); - } - catch(std::runtime_error) - { - mi = NULL; - } - } // shared_name!="" + try + { + mi = music_manager->getMusicInformation(shared_name); + } + catch(std::runtime_error) + { + mi = NULL; + } + } // shared_name!="" + } + catch (std::exception& e) + { + mi = NULL; + } + } if(!mi) {