Make code more robust to print an error message instead of crashing in weird case reproduced by Arthur_D only
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@7211 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
74c0c19688
commit
39ebfcb9ea
@ -138,6 +138,13 @@ void ChallengesScreen::eventCallback(GUIEngine::Widget* widget, const std::strin
|
||||
UserConfigParams::m_default_kart.revertToDefaults();
|
||||
}
|
||||
|
||||
const Challenge* c = unlock_manager->getChallenge(selection);
|
||||
if (c == NULL)
|
||||
{
|
||||
std::cerr << "[ChallengesScreen] ERROR: cannot find challenge '" << selection.c_str() << "'!\n";
|
||||
return;
|
||||
}
|
||||
|
||||
// Use latest used device
|
||||
InputDevice* device = input_manager->getDeviceList()->getLatestUsedDevice();
|
||||
|
||||
@ -160,7 +167,7 @@ void ChallengesScreen::eventCallback(GUIEngine::Widget* widget, const std::strin
|
||||
network_manager->initCharacterDataStructures();
|
||||
|
||||
// Launch challenge
|
||||
unlock_manager->getChallenge(selection)->setRace();
|
||||
c->setRace();
|
||||
|
||||
// Sets up kart info, including random list of kart for AI
|
||||
network_manager->setupPlayerKartInfo();
|
||||
|
Loading…
Reference in New Issue
Block a user