additional error checking
authordisplacer
Sat, 03 Feb 2007 00:04:52 +0000
changeset 379 e4cd3cd209c6
parent 378 dde4a4a3e0e1
child 380 86f3d818da1c
additional error checking
QTfrontend/game.cpp
QTfrontend/tcpBase.cpp
QTfrontend/teamselhelper.cpp
--- a/QTfrontend/game.cpp	Fri Feb 02 21:04:36 2007 +0000
+++ b/QTfrontend/game.cpp	Sat Feb 03 00:04:52 2007 +0000
@@ -260,6 +260,7 @@
 	stream.writeRawData(demo->constData(), demo->size());
 	demofile.close();
 	delete demo;
+	demo=0;
 }
 
 void HWGame::PlayDemo(const QString & demofilename)
--- a/QTfrontend/tcpBase.cpp	Fri Feb 02 21:04:36 2007 +0000
+++ b/QTfrontend/tcpBase.cpp	Sat Feb 03 00:04:52 2007 +0000
@@ -149,7 +149,9 @@
 			if(m_isDemoMode) demo->append(toSendBuf);
 			toSendBuf.clear();
 		}
-		IPCSocket->write(buf);
-		if(m_isDemoMode) demo->append(buf);
+		if(!buf.isEmpty()) {
+		  IPCSocket->write(buf);
+		  if(m_isDemoMode && demo) demo->append(buf);
+		}
 	}
 }
--- a/QTfrontend/teamselhelper.cpp	Fri Feb 02 21:04:36 2007 +0000
+++ b/QTfrontend/teamselhelper.cpp	Sat Feb 03 00:04:52 2007 +0000
@@ -125,7 +125,6 @@
 					   pOurFrameTeams->availableColors.end(), color);
     if(pOurFrameTeams->currentColor==pOurFrameTeams->availableColors.end()) {
       // error condition
-      throw;
       pOurFrameTeams->currentColor=pOurFrameTeams->availableColors.begin();
     }
   }