From 95444d1202884db8d13bf315e4917ef9a3db8ea6 Mon Sep 17 00:00:00 2001 From: Meltie2013 Date: Tue, 16 Mar 2021 15:36:24 +0000 Subject: [PATCH] Fix a crash when using an invalid display id with command ```npc set model```. --- src/game/ChatCommands/CreatureCommands.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/game/ChatCommands/CreatureCommands.cpp b/src/game/ChatCommands/CreatureCommands.cpp index e1bb7080..3aca2d4c 100644 --- a/src/game/ChatCommands/CreatureCommands.cpp +++ b/src/game/ChatCommands/CreatureCommands.cpp @@ -671,6 +671,13 @@ bool ChatHandler::HandleNpcSetModelCommand(char* args) return false; } + if (!sCreatureDisplayInfoStore.LookupEntry(displayId)) + { + SendSysMessage(LANG_BAD_VALUE); + SetSentErrorMessage(true); + return false; + } + pCreature->SetDisplayId(displayId); pCreature->SetNativeDisplayId(displayId);