Avoid crash if networking was selected, but not actually started.
This commit is contained in:
@@ -1518,7 +1518,7 @@ int main(int argc, char *argv[] )
|
||||
StateManager::get()->resetActivePlayers();
|
||||
if(input_manager) delete input_manager; // if early crash avoid delete NULL
|
||||
|
||||
if(NetworkConfig::get()->isNetworking())
|
||||
if(NetworkConfig::get()->isNetworking() && STKHost::existHost())
|
||||
STKHost::get()->abort();
|
||||
|
||||
cleanSuperTuxKart();
|
||||
@@ -1628,7 +1628,7 @@ static void cleanSuperTuxKart()
|
||||
// FIXME: do we need to wait for threads there, can they be
|
||||
// moved further up?
|
||||
ServersManager::deallocate();
|
||||
if(NetworkConfig::get()->isNetworking())
|
||||
if(NetworkConfig::get()->isNetworking() && STKHost::existHost())
|
||||
STKHost::destroy();
|
||||
|
||||
cleanUserConfig();
|
||||
|
||||
@@ -97,8 +97,12 @@ public:
|
||||
/** Set that this is a LAN networked game. */
|
||||
void setIsLAN() { m_network_type = NETWORK_LAN; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Set that this is a WAN networked game. */
|
||||
void setIsWAN() { m_network_type = NETWORK_WAN; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Set that this is not a networked game. */
|
||||
void unsetNetworking() { m_network_type = NETWORK_NONE; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Sets the maximum number of players for this server. */
|
||||
void setMaxPlayers(int n) { m_max_players = n; }
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user