fix(Core/Command): crash on set model to npc if not valid (#4874)

This commit is contained in:
r0m1ntik
2021-03-21 15:19:18 +01:00
committed by GitHub
parent 00f7a6bbde
commit edd6d65fb2

View File

@@ -21,6 +21,7 @@ EndScriptData */
#include "ScriptMgr.h"
#include "TargetedMovementGenerator.h" // for HandleNpcUnFollowCommand
#include "Transport.h"
#include <string>
struct NpcFlagText
{
@@ -922,6 +923,13 @@ public:
return false;
}
if (!sCreatureDisplayInfoStore.LookupEntry(displayId))
{
handler->PSendSysMessage(LANG_COMMAND_FACTION_INVPARAM, std::to_string(displayId).c_str());
handler->SetSentErrorMessage(true);
return false;
}
creature->SetDisplayId(displayId);
creature->SetNativeDisplayId(displayId);