Core/SAI: Fixed crashes when SAI targets pets that use sai if not tamed

Closes #21870
This commit is contained in:
Shauren authored and Aokromes committed 2018-04-25 00:22:02 +02:00
1 parent ec9551ce20
commit 9fd67b7044
1 file changed
+2 -2
@@ -65,7 +65,7 @@ SmartScript::~SmartScript()
bool SmartScript::IsSmart(Creature* c /*= nullptr*/)
{
bool smart = true;
if (c && c->GetAIName() != "SmartAI")
if (!dynamic_cast<SmartAI*>(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<SmartGameObjectAI*>(g->AI()))
smart = false;
if (!go || go->GetAIName() != "SmartGameObjectAI")