aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Chat/ChatCommands
diff options
context:
space:
mode:
authorTreeston <treeston.mmoc@gmail.com>2020-10-08 16:45:20 +0200
committerTreeston <treeston.mmoc@gmail.com>2020-10-08 17:01:42 +0200
commit3ec98bf2410bb8fa73fe6b386a6e766bef575e97 (patch)
tree4bbc9a9a17419bb30059da77a70f6157b6243210 /src/server/game/Chat/ChatCommands
parent5f001ddb2ba7974696f34c8da32ae901faf81bf9 (diff)
Core/ChatCommands: Fix a potential crash if a custom chat command does not have a specified help string
Diffstat (limited to 'src/server/game/Chat/ChatCommands')
-rw-r--r--src/server/game/Chat/ChatCommands/ChatCommand.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/server/game/Chat/ChatCommands/ChatCommand.cpp b/src/server/game/Chat/ChatCommands/ChatCommand.cpp
index add4d4a0686..f8b01feca33 100644
--- a/src/server/game/Chat/ChatCommands/ChatCommand.cpp
+++ b/src/server/game/Chat/ChatCommands/ChatCommand.cpp
@@ -173,8 +173,13 @@ void Trinity::Impl::ChatCommands::ChatCommandNode::SendCommandHelp(ChatHandler&
{
if (std::holds_alternative<TrinityStrings>(_help))
handler.SendSysMessage(std::get<TrinityStrings>(_help));
- else
+ else if (std::holds_alternative<std::string>(_help))
handler.SendSysMessage(std::get<std::string>(_help));
+ else
+ {
+ handler.PSendSysMessage(LANG_CMD_HELP_GENERIC, STRING_VIEW_FMT_ARG(_name));
+ handler.PSendSysMessage(LANG_CMD_NO_HELP_AVAILABLE, STRING_VIEW_FMT_ARG(_name));
+ }
}
bool header = false;