Core/Commands: Fixes a few crashes with commands

This commit is contained in:
hondacrx
2022-10-02 21:50:21 -04:00
parent 4cd461bb95
commit 43ea6fbaa1
+2 -2
View File
@@ -277,7 +277,7 @@ namespace Game.Chat
case nameof(ItemTemplate): case nameof(ItemTemplate):
{ {
ChatCommandResult result = TryConsume(out dynamic tempVal, typeof(uint), handler, args); ChatCommandResult result = TryConsume(out dynamic tempVal, typeof(uint), handler, args);
if (!result.IsSuccessful() || (val = Global.ObjectMgr.GetItemTemplate(tempVal))) if (!result.IsSuccessful() || (val = Global.ObjectMgr.GetItemTemplate(tempVal)) != null)
return result; return result;
return ChatCommandResult.FromErrorMessage(handler.GetParsedString(CypherStrings.CmdparserItemNoExist, tempVal)); return ChatCommandResult.FromErrorMessage(handler.GetParsedString(CypherStrings.CmdparserItemNoExist, tempVal));
@@ -293,7 +293,7 @@ namespace Game.Chat
case nameof(Quest): case nameof(Quest):
{ {
ChatCommandResult result = TryConsume(out dynamic tempVal, typeof(uint), handler, args); ChatCommandResult result = TryConsume(out dynamic tempVal, typeof(uint), handler, args);
if (!result.IsSuccessful() || (val = Global.ObjectMgr.GetQuestTemplate(tempVal))) if (!result.IsSuccessful() || (val = Global.ObjectMgr.GetQuestTemplate(tempVal)) != null)
return result; return result;
return ChatCommandResult.FromErrorMessage(handler.GetParsedString(CypherStrings.CmdparserQuestNoExist, tempVal)); return ChatCommandResult.FromErrorMessage(handler.GetParsedString(CypherStrings.CmdparserQuestNoExist, tempVal));