Fix a crash when using an invalid display id with command ``npc set model``.

This commit is contained in:
Meltie2013 2021-03-16 15:36:24 +00:00 committed by Antz
parent f223312364
commit 95444d1202
No known key found for this signature in database
GPG Key ID: 0DF907270598C85F

View File

@ -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);