Scripts/Misc: Fix possible crash
Fix possible NULL-dereference exception happening in PlayerOrPet checks used in Ulduar and Temple Of Ahn Qiraj (cherry picked from commit 5f0f152345ec7e9cc6195ba8f59f316a1cad90f7)
This commit is contained in:
@@ -208,11 +208,13 @@ class PlayerOrPetCheck
|
||||
public:
|
||||
bool operator()(WorldObject* object) const
|
||||
{
|
||||
if (object->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!object->ToCreature()->IsPet())
|
||||
return true;
|
||||
if (object->GetTypeId() == TYPEID_PLAYER)
|
||||
return false;
|
||||
|
||||
return false;
|
||||
if (Creature* creature = object->ToCreature())
|
||||
return !creature->IsPet();
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -425,11 +425,13 @@ class PlayerOrPetCheck
|
||||
public:
|
||||
bool operator()(WorldObject* object) const
|
||||
{
|
||||
if (object->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!object->ToCreature()->IsPet())
|
||||
return true;
|
||||
if (object->GetTypeId() == TYPEID_PLAYER)
|
||||
return false;
|
||||
|
||||
return false;
|
||||
if (Creature* creature = object->ToCreature())
|
||||
return !creature->IsPet();
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user