From 1fa9efc091c2495975f48f5c01b6a98ff1a6d9a4 Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Fri, 20 Aug 2010 20:51:25 +0000 Subject: [PATCH] - alittle more bullet proofing using NULL pointer checks --- source/glest_game/network/connection_slot.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/source/glest_game/network/connection_slot.cpp b/source/glest_game/network/connection_slot.cpp index 22495c9b..a3ab34c0 100644 --- a/source/glest_game/network/connection_slot.cpp +++ b/source/glest_game/network/connection_slot.cpp @@ -241,16 +241,20 @@ void ConnectionSlot::update(bool checkForNewClients) { if(hasOpenSlots == false) { SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] no open slots, disconnecting client\n",__FILE__,__FUNCTION__); - NetworkMessageIntro networkMessageIntro(getNetworkVersionString(), socket->getHostName(), playerIndex, nmgstNoSlots); - sendMessage(&networkMessageIntro); + if(socket != NULL) { + NetworkMessageIntro networkMessageIntro(getNetworkVersionString(), socket->getHostName(), playerIndex, nmgstNoSlots); + sendMessage(&networkMessageIntro); + } close(); } else { SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] client will be assigned to the next open slot\n",__FILE__,__FUNCTION__); - NetworkMessageIntro networkMessageIntro(getNetworkVersionString(), socket->getHostName(), playerIndex, nmgstOk); - sendMessage(&networkMessageIntro); + if(socket != NULL) { + NetworkMessageIntro networkMessageIntro(getNetworkVersionString(), socket->getHostName(), playerIndex, nmgstOk); + sendMessage(&networkMessageIntro); + } } } } @@ -258,7 +262,7 @@ void ConnectionSlot::update(bool checkForNewClients) { else { SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); - if(socket->isConnected()) { + if(socket != NULL && socket->isConnected()) { this->clearChatInfo(); bool gotTextMsg = true;