QTfrontend/game.cpp
changeset 406 ea90c6358054
parent 397 d9bb21b4400d
child 419 fdeed9718e6b
equal deleted inserted replaced
405:339d7735d829 406:ea90c6358054
   198 
   198 
   199 void HWGame::onClientRead()
   199 void HWGame::onClientRead()
   200 {
   200 {
   201 	quint8 msglen;
   201 	quint8 msglen;
   202 	quint32 bufsize;
   202 	quint32 bufsize;
   203 	while (((bufsize = readbuffer.size()) > 0) &&
   203 	while (!readbuffer.isEmpty() && ((bufsize = readbuffer.size()) > 0) &&
   204 			((msglen = readbuffer.data()[0]) < bufsize))
   204 			((msglen = readbuffer.data()[0]) < bufsize))
   205 	{
   205 	{
   206 		QByteArray msg = readbuffer.left(msglen + 1);
   206 		QByteArray msg = readbuffer.left(msglen + 1);
   207 		readbuffer.remove(0, msglen + 1);
   207 		readbuffer.remove(0, msglen + 1);
   208 		ParseMessage(msg);
   208 		ParseMessage(msg);