fix(Core): Crashfix. (#12092)
This commit is contained in:
@@ -496,7 +496,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
//show info of gameobject
|
//show info of gameobject
|
||||||
static bool HandleGameObjectInfoCommand(ChatHandler* handler, Optional<Variant<GameObjectEntry, std::string_view>> objectId)
|
static bool HandleGameObjectInfoCommand(ChatHandler* handler, Optional<EXACT_SEQUENCE("guid")> isGuid, Variant<Hyperlink<gameobject_entry>, Hyperlink<gameobject>, uint32> data)
|
||||||
{
|
{
|
||||||
uint32 entry = 0;
|
uint32 entry = 0;
|
||||||
uint32 type = 0;
|
uint32 type = 0;
|
||||||
@@ -505,17 +505,24 @@ public:
|
|||||||
uint32 lootId = 0;
|
uint32 lootId = 0;
|
||||||
GameObject* gameObject = nullptr;
|
GameObject* gameObject = nullptr;
|
||||||
|
|
||||||
if (!objectId)
|
ObjectGuid::LowType spawnId = 0;
|
||||||
|
if (isGuid || data.holds_alternative<Hyperlink<gameobject>>())
|
||||||
{
|
{
|
||||||
if (WorldObject* object = handler->getSelectedObject())
|
spawnId = *data;
|
||||||
|
GameObjectData const* spawnData = sObjectMgr->GetGOData(spawnId);
|
||||||
|
if (!spawnData)
|
||||||
{
|
{
|
||||||
entry = object->GetEntry();
|
handler->PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, spawnId);
|
||||||
if (object->GetTypeId() == TYPEID_GAMEOBJECT)
|
handler->SetSentErrorMessage(true);
|
||||||
gameObject = object->ToGameObject();
|
return false;
|
||||||
}
|
}
|
||||||
|
entry = spawnData->id;
|
||||||
|
gameObject = handler->GetObjectFromPlayerMapByDbGuid(spawnId);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
entry = static_cast<uint32>(objectId->get<GameObjectEntry>());
|
{
|
||||||
|
entry = *data;
|
||||||
|
}
|
||||||
|
|
||||||
GameObjectTemplate const* gameObjectInfo = sObjectMgr->GetGameObjectTemplate(entry);
|
GameObjectTemplate const* gameObjectInfo = sObjectMgr->GetGameObjectTemplate(entry);
|
||||||
if (!gameObjectInfo)
|
if (!gameObjectInfo)
|
||||||
|
|||||||
Reference in New Issue
Block a user