Don't crash when music not found
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@6573 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
596b726362
commit
f0227bfd19
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -263,18 +263,26 @@ void Track::getMusicInformation(std::vector<std::string>& 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)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user