We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8909a18 commit 7f83587Copy full SHA for 7f83587
2 files changed
src/game/ChatCommands/PlayerCommands.cpp
@@ -1078,12 +1078,18 @@ bool ChatHandler::HandleAddItemCommand(char* args)
1078
}
1079
1080
1081
- Player* pl = m_session->GetPlayer();
+ Player* pl = m_session ? m_session->GetPlayer() : nullptr;
1082
Player* plTarget = getSelectedPlayer();
1083
if (!plTarget)
1084
{
1085
plTarget = pl;
1086
1087
+ if (!plTarget)
1088
+ {
1089
+ SendSysMessage(LANG_NO_CHAR_SELECTED);
1090
+ SetSentErrorMessage(true);
1091
+ return false;
1092
+ }
1093
1094
DETAIL_LOG(GetMangosString(LANG_ADDITEM), itemId, count);
1095
@@ -1140,7 +1146,10 @@ bool ChatHandler::HandleAddItemCommand(char* args)
1140
1146
item->SetBinding(false);
1141
1147
1142
1148
1143
- pl->SendNewItem(item, count, false, true);
1149
+ if (pl)
1150
1151
+ pl->SendNewItem(item, count, false, true);
1152
1144
1153
if (pl != plTarget)
1145
1154
1155
plTarget->SendNewItem(item, count, true, false);
src/game/WorldHandlers/Chat.cpp
@@ -786,7 +786,7 @@ ChatCommand* ChatHandler::getCommandTable()
786
{ "levelup", SEC_ADMINISTRATOR, true, &ChatHandler::HandleLevelUpCommand, "", NULL },
787
{ "showarea", SEC_ADMINISTRATOR, true, &ChatHandler::HandleShowAreaCommand, "", NULL },
788
{ "hidearea", SEC_ADMINISTRATOR, true, &ChatHandler::HandleHideAreaCommand, "", NULL },
789
- { "additem", SEC_ADMINISTRATOR, false, &ChatHandler::HandleAddItemCommand, "", NULL },
+ { "additem", SEC_ADMINISTRATOR, true, &ChatHandler::HandleAddItemCommand, "", NULL },
790
{ "additemset", SEC_ADMINISTRATOR, false, &ChatHandler::HandleAddItemSetCommand, "", NULL },
791
{ "bank", SEC_ADMINISTRATOR, false, &ChatHandler::HandleBankCommand, "", NULL },
792
{ "wchange", SEC_ADMINISTRATOR, false, &ChatHandler::HandleChangeWeatherCommand, "", NULL },
0 commit comments