aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjackpoz <giacomopoz@gmail.com>2020-07-05 20:22:45 +0200
committerShauren <shauren.trinity@gmail.com>2022-01-21 18:55:48 +0100
commit8fd7a4b6e5f6b728c4ae40cfd2080c4dae004e8f (patch)
treeeb3e1267abcb958e11d9707eb42584b897620d23
parentd07ba6a1033a5edd43f4f8e872862f4f5db5ca2a (diff)
Core/PetAI: Validate GetCharmInfo()
Fixes #24870 (cherry picked from commit bf62901053d20da790e78394cd9b2a3129d28afa)
-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 878bdc27618..260c9938e0c 100644
--- a/src/server/game/AI/CoreAI/PetAI.cpp
+++ b/src/server/game/AI/CoreAI/PetAI.cpp
@@ -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;
}