aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjackpoz <giacomopoz@gmail.com>2020-07-05 20:22:45 +0200
committerjackpoz <giacomopoz@gmail.com>2020-07-05 20:22:45 +0200
commitbf62901053d20da790e78394cd9b2a3129d28afa (patch)
tree54a34ad0f9a9df63de40fea89eb4a39f2d3fe926 /src
parent519192f2108a4ae13d9f7c3906da6d726da60df3 (diff)
Core/PetAI: Validate GetCharmInfo()
Fixes #24870
Diffstat (limited to 'src')
-rw-r--r--src/server/game/AI/CoreAI/PetAI.cpp8
1 files changed, 7 insertions, 1 deletions
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;
}