mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-21 01:37:37 +01:00
Core/ChatCommands: Fix a potential crash if a custom chat command does not have a specified help string
This commit is contained in:
6
sql/updates/world/3.3.5/2020_10_08_00_world.sql
Normal file
6
sql/updates/world/3.3.5/2020_10_08_00_world.sql
Normal file
@@ -0,0 +1,6 @@
|
||||
--
|
||||
DELETE FROM `trinity_string` WHERE `entry`=196;
|
||||
INSERT INTO `trinity_string` (`entry`,`content_default`) VALUES
|
||||
(196, 'There is no detailed usage information associated with \'%.*s\'.
|
||||
This should never occur for stock TrinityCore commands - if it does, report this as a bug.
|
||||
If this is a custom command, use `trinity_string` to specify it. Look at cs_achievement.cpp for example usage.');
|
||||
@@ -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;
|
||||
|
||||
@@ -229,7 +229,8 @@ enum TrinityStrings
|
||||
LANG_SUBCMD_INVALID = 193,
|
||||
LANG_CMD_AMBIGUOUS = 194,
|
||||
LANG_CMD_HELP_GENERIC = 195,
|
||||
// Room for more level 1 196-199 not used
|
||||
LANG_CMD_NO_HELP_AVAILABLE = 196,
|
||||
// Room for more level 1 197-199 not used
|
||||
|
||||
// level 2 chat
|
||||
LANG_NO_SELECTION = 200,
|
||||
|
||||
Reference in New Issue
Block a user