From 9fd67b7044793c95c68a595c12a529e02409d19b Mon Sep 17 00:00:00 2001 From: Shauren Date: Mon, 23 Apr 2018 20:27:48 +0200 Subject: [PATCH] Core/SAI: Fixed crashes when SAI targets pets that use sai if not tamed Closes #21870 --- src/server/game/AI/SmartScripts/SmartScript.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index 5853c8914e..26ec90fdd6 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -65,7 +65,7 @@ SmartScript::~SmartScript() bool SmartScript::IsSmart(Creature* c /*= nullptr*/) { bool smart = true; - if (c && c->GetAIName() != "SmartAI") + if (!dynamic_cast(c->AI())) smart = false; if (!me || me->GetAIName() != "SmartAI") @@ -80,7 +80,7 @@ bool SmartScript::IsSmart(Creature* c /*= nullptr*/) bool SmartScript::IsSmartGO(GameObject* g /*= nullptr*/) { bool smart = true; - if (g && g->GetAIName() != "SmartGameObjectAI") + if (!dynamic_cast(g->AI())) smart = false; if (!go || go->GetAIName() != "SmartGameObjectAI")