QTfrontend/net/newnetclient.cpp
changeset 13327 b77a9380dd0f
parent 12902 fc47fc4af6bd
child 13663 73993abb85d7
--- a/QTfrontend/net/newnetclient.cpp	Fri Apr 13 00:17:30 2018 +0200
+++ b/QTfrontend/net/newnetclient.cpp	Fri Apr 13 13:03:51 2018 -0400
@@ -99,7 +99,7 @@
 
 void HWNewNet::CreateRoom(const QString & room, const QString & password)
 {
-    if(netClientState != InLobby)
+    if(netClientState != InLobby || !ByteLength(room))
     {
         qWarning("Illegal try to create room!");
         return;
@@ -176,6 +176,11 @@
     RawSendNet(QString("EM%1%2").arg(delimiter).arg(msg));
 }
 
+int HWNewNet::ByteLength(const QString & str)
+{
+	return str.toUtf8().size();
+}
+
 void HWNewNet::RawSendNet(const QString & str)
 {
     RawSendNet(str.toUtf8());
@@ -909,7 +914,7 @@
 
 void HWNewNet::chatLineToNet(const QString& str)
 {
-    if(str != "")
+    if(ByteLength(str))
     {
         RawSendNet(QString("CHAT") + delimiter + str);
         QString action = HWProto::chatStringToAction(str);
@@ -922,7 +927,7 @@
 
 void HWNewNet::chatLineToLobby(const QString& str)
 {
-    if(str != "")
+    if(ByteLength(str))
     {
         RawSendNet(QString("CHAT") + delimiter + str);
         QString action = HWProto::chatStringToAction(str);