From d56a729041baf7e0b481244469237ec1b6bbbad4 Mon Sep 17 00:00:00 2001 From: auria Date: Sat, 4 Jun 2011 00:17:22 +0000 Subject: [PATCH] Better error handling git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@8811 178a84e3-b1eb-0310-8ba1-8eac791a3b58 --- src/states_screens/grand_prix_lose.cpp | 2 +- src/states_screens/grand_prix_win.cpp | 2 +- src/states_screens/race_result_gui.cpp | 9 ++++++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/states_screens/grand_prix_lose.cpp b/src/states_screens/grand_prix_lose.cpp index ce269fc71..472402d0d 100644 --- a/src/states_screens/grand_prix_lose.cpp +++ b/src/states_screens/grand_prix_lose.cpp @@ -85,7 +85,7 @@ GrandPrixLose::GrandPrixLose() : Screen("grand_prix_lose.stkgui") } catch (std::exception& e) { - fprintf(stderr, "%s", e.what()); + fprintf(stderr, "[GrandPrixLose] WARNING: exception caught when trying to load music: %s\n", e.what()); m_music = NULL; } } // GrandPrixLose diff --git a/src/states_screens/grand_prix_win.cpp b/src/states_screens/grand_prix_win.cpp index 9fda0d268..5ba68220c 100644 --- a/src/states_screens/grand_prix_win.cpp +++ b/src/states_screens/grand_prix_win.cpp @@ -68,7 +68,7 @@ GrandPrixWin::GrandPrixWin() : Screen("grand_prix_win.stkgui") } catch (std::exception& e) { - fprintf(stderr, "%s", e.what()); + fprintf(stderr, "[GrandPrixWin] WARNING: exception caught when trying to load music: %s\n", e.what()); m_music = NULL; } } // GrandPrixWin diff --git a/src/states_screens/race_result_gui.cpp b/src/states_screens/race_result_gui.cpp index 5f7019514..34dd052f1 100644 --- a/src/states_screens/race_result_gui.cpp +++ b/src/states_screens/race_result_gui.cpp @@ -389,7 +389,14 @@ void RaceResultGUI::onUpdate(float dt, irr::video::IVideoDriver*) if (m_finish_sound != NULL && m_finish_sound->getStatus() != SFXManager::SFX_PLAYING) { - music_manager->startMusic( music_manager->getMusicInformation("race_summary.music") ); + try + { + music_manager->startMusic( music_manager->getMusicInformation("race_summary.music") ); + } + catch (std::exception& e) + { + fprintf(stderr, "[RaceResultGUI] WARNING: exception caught when trying to load music: %s\n", e.what()); + } } } // onUpdate