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_throttle_FPS = false;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
m_music = music_manager->getMusicInformation(file_manager->getMusicFile("lose_theme.music"));
|
m_music = music_manager->getMusicInformation(file_manager->getMusicFile("lose_theme.music"));
|
||||||
|
}
|
||||||
|
catch (std::exception& e)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "%s", e.what());
|
||||||
|
m_music = NULL;
|
||||||
|
}
|
||||||
} // GrandPrixLose
|
} // GrandPrixLose
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------
|
||||||
@ -74,7 +82,6 @@ void GrandPrixLose::loadedFromFile()
|
|||||||
void GrandPrixLose::init()
|
void GrandPrixLose::init()
|
||||||
{
|
{
|
||||||
Screen::init();
|
Screen::init();
|
||||||
//music_manager->startMusic(music_manager->getMusicInformation(file_manager->getMusicFile("lose_theme.music")));
|
|
||||||
|
|
||||||
m_phase = 1;
|
m_phase = 1;
|
||||||
m_sky_angle = 0.0f;
|
m_sky_angle = 0.0f;
|
||||||
|
@ -37,7 +37,15 @@ GrandPrixWin::GrandPrixWin() : Screen("grand_prix_win.stkgui")
|
|||||||
|
|
||||||
m_throttle_FPS = false;
|
m_throttle_FPS = false;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
m_music = music_manager->getMusicInformation(file_manager->getMusicFile("win_theme.music"));
|
m_music = music_manager->getMusicInformation(file_manager->getMusicFile("win_theme.music"));
|
||||||
|
}
|
||||||
|
catch (std::exception& e)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "%s", e.what());
|
||||||
|
m_music = NULL;
|
||||||
|
}
|
||||||
} // GrandPrixWin
|
} // GrandPrixWin
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------
|
||||||
@ -131,8 +139,6 @@ void GrandPrixWin::init()
|
|||||||
unlocked_label->add();
|
unlocked_label->add();
|
||||||
}
|
}
|
||||||
|
|
||||||
//music_manager->startMusic(music_manager->getMusicInformation(file_manager->getMusicFile("win_theme.music")));
|
|
||||||
|
|
||||||
m_phase = 1;
|
m_phase = 1;
|
||||||
m_sky_angle = 0.0f;
|
m_sky_angle = 0.0f;
|
||||||
m_global_time = 0.0f;
|
m_global_time = 0.0f;
|
||||||
|
@ -262,6 +262,8 @@ void Track::getMusicInformation(std::vector<std::string>& filenames,
|
|||||||
mi = NULL;
|
mi = NULL;
|
||||||
}
|
}
|
||||||
if(!mi)
|
if(!mi)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
std::string shared_name = file_manager->getMusicFile(filenames[i]);
|
std::string shared_name = file_manager->getMusicFile(filenames[i]);
|
||||||
if(shared_name!="")
|
if(shared_name!="")
|
||||||
@ -276,6 +278,12 @@ void Track::getMusicInformation(std::vector<std::string>& filenames,
|
|||||||
}
|
}
|
||||||
} // shared_name!=""
|
} // shared_name!=""
|
||||||
}
|
}
|
||||||
|
catch (std::exception& e)
|
||||||
|
{
|
||||||
|
mi = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
if(!mi)
|
if(!mi)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Music information file '%s' not found - ignored.\n",
|
fprintf(stderr, "Music information file '%s' not found - ignored.\n",
|
||||||
|
Loading…
Reference in New Issue
Block a user