From bf62901053d20da790e78394cd9b2a3129d28afa Mon Sep 17 00:00:00 2001 From: jackpoz Date: Sun, 5 Jul 2020 20:22:45 +0200 Subject: Core/PetAI: Validate GetCharmInfo() Fixes #24870 --- src/server/game/AI/CoreAI/PetAI.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/AI/CoreAI/PetAI.cpp b/src/server/game/AI/CoreAI/PetAI.cpp index db9f1c7caf4..f38907b4892 100644 --- a/src/server/game/AI/CoreAI/PetAI.cpp +++ b/src/server/game/AI/CoreAI/PetAI.cpp @@ -366,6 +366,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()) @@ -492,7 +498,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; } -- cgit v1.2.3