# HG changeset patch
# User Wuzzy <Wuzzy2@mail.ru>
# Date 1538705876 -7200
# Node ID 184584b82c4c127db7b135960c7834c4afaf8788
# Parent  7c333cffd63ebd9277a81c40645ac78260026a70
Catch empty chat commands in engine and frontend

diff -r 7c333cffd63e -r 184584b82c4c QTfrontend/ui/widget/chatwidget.cpp
--- a/QTfrontend/ui/widget/chatwidget.cpp	Fri Oct 05 04:00:16 2018 +0200
+++ b/QTfrontend/ui/widget/chatwidget.cpp	Fri Oct 05 04:17:56 2018 +0200
@@ -868,6 +868,12 @@
     if (line[0] == '/')
     {
         QString tline = line.trimmed();
+        if (tline.length() <= 1)
+        {
+            // Empty chat command
+            displayWarning(QCoreApplication::translate("server", "Unknown command or invalid parameters. Say '/help' in chat for a list of commands."));
+            return true;
+        }
         if (tline.startsWith("/me"))
             return false; // not a real command
         else if (tline == "/clear") {
diff -r 7c333cffd63e -r 184584b82c4c hedgewars/uChat.pas
--- a/hedgewars/uChat.pas	Fri Oct 05 04:00:16 2018 +0200
+++ b/hedgewars/uChat.pas	Fri Oct 05 04:17:56 2018 +0200
@@ -465,6 +465,12 @@
 
 if (s[1] = '/') then
     begin
+    if (Length(s) <= 1) then
+        begin
+        // empty chat command
+        AddChatString(#0 + trcmd[sidCmdUnknown]);
+        exit;
+        end;
 
     // Ignore message-type commands with empty argument list
     if (copy(s, 2, 2) = 'me') and (Length(s) = 3) then