From edd5f4a19267b55fe015150d653969f46ecd50a4 Mon Sep 17 00:00:00 2001 From: ShinDarth Date: Tue, 23 Aug 2016 10:02:41 +0200 Subject: Core/Chat: fixed crash in commands closes #110 --- src/game/Chat/Chat.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/game/Chat/Chat.cpp b/src/game/Chat/Chat.cpp index 432fa19c97..34946bc92e 100644 --- a/src/game/Chat/Chat.cpp +++ b/src/game/Chat/Chat.cpp @@ -136,7 +136,7 @@ bool ChatHandler::hasStringAbbr(const char* name, const char* part) if (!*part) return false; - for (;;) + while (true) { if (!*part) return true; @@ -246,7 +246,6 @@ bool ChatHandler::ExecuteCommandInTable(std::vector const& table, c for (uint32 i = 0; i < table.size(); ++i) { - // for data fill use full explicit command names if (table[i].Name == nullptr) continue; @@ -258,6 +257,9 @@ bool ChatHandler::ExecuteCommandInTable(std::vector const& table, c { for (uint32 j = 0; j < table.size(); ++j) { + if (table[j].Name == nullptr) + continue; + if (!hasStringAbbr(table[j].Name, cmd.c_str())) continue; @@ -268,7 +270,6 @@ bool ChatHandler::ExecuteCommandInTable(std::vector const& table, c } } } - if (match) continue; -- cgit v1.2.3