Made STK more robust in case that the name of a track requested on the

command line does not exist. It now aborts with a useful error message
in this case.


git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@2934 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2009-01-15 23:05:50 +00:00
parent b0dcfcb0a6
commit 2287757c6e
2 changed files with 12 additions and 3 deletions

View File

@ -33,6 +33,7 @@
//-----------------------------------------------------------------------------
LinearWorld::LinearWorld() : World()
{
m_kart_display_info = NULL;
} // LinearWorld
// ----------------------------------------------------------------------------
@ -82,7 +83,10 @@ void LinearWorld::init()
//-----------------------------------------------------------------------------
LinearWorld::~LinearWorld()
{
delete[] m_kart_display_info;
// In case that a track is not found, m_kart_display info was never
// initialised.
if(m_kart_display_info)
delete[] m_kart_display_info;
} // ~LinearWorld
//-----------------------------------------------------------------------------

View File

@ -57,6 +57,7 @@
//-----------------------------------------------------------------------------
World::World() : TimedRace()
{
m_physics = NULL;
}
void World::init()
{
@ -172,7 +173,9 @@ World::~World()
{
item_manager->cleanup();
delete race_state;
m_track->cleanup();
// In case that a race is aborted (e.g. track not found) m_track is 0.
if(m_track)
m_track->cleanup();
// Clear all callbacks
callback_manager->clear(CB_TRACK);
@ -181,7 +184,9 @@ World::~World()
m_kart.clear();
projectile_manager->cleanup();
delete m_physics;
// In case that the track is not found, m_physics is still undefined.
if(m_physics)
delete m_physics;
sound_manager -> stopMusic();