mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Core/PetAI: Validate GetCharmInfo()
Fixes #24870
(cherry picked from commit bf62901053)
This commit is contained in:
@@ -367,6 +367,12 @@ void PetAI::HandleReturnMovement()
|
||||
if (me->IsCharmed())
|
||||
return;
|
||||
|
||||
if (!me->GetCharmInfo())
|
||||
{
|
||||
TC_LOG_WARN("scripts.ai.petai", "me->GetCharmInfo() is NULL in PetAI::HandleReturnMovement(). Debug info: %s", GetDebugInfo().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
if (me->GetCharmInfo()->HasCommandState(COMMAND_STAY))
|
||||
{
|
||||
if (!me->GetCharmInfo()->IsAtStay() && !me->GetCharmInfo()->IsReturning())
|
||||
@@ -493,7 +499,7 @@ bool PetAI::CanAttack(Unit* target)
|
||||
|
||||
if (!me->GetCharmInfo())
|
||||
{
|
||||
TC_LOG_ERROR("scripts.ai.petai", "me->GetCharmInfo() is NULL in PetAI::CanAttack(). Debug info: %s", GetDebugInfo().c_str());
|
||||
TC_LOG_WARN("scripts.ai.petai", "me->GetCharmInfo() is NULL in PetAI::CanAttack(). Debug info: %s", GetDebugInfo().c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user