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

Closes #21870

(cherry picked from commit beb333738db0d493bf95994eb5557e174e5dd3a6)
This commit is contained in:
Shauren
2021-09-26 12:43:18 +02:00
parent 104f9a334a
commit 334b02e1da
@@ -74,7 +74,7 @@ bool SmartScript::IsSmart(Creature* c, bool silent)
return false;
bool smart = true;
if (c && c->GetAIName() != "SmartAI")
if (!dynamic_cast<SmartAI*>(c->AI()))
smart = false;
if (!smart && !silent)
@@ -90,7 +90,7 @@ bool SmartScript::IsSmart(GameObject* g, bool silent)
return false;
bool smart = true;
if (g && g->GetAIName() != "SmartGameObjectAI")
if (!dynamic_cast<SmartGameObjectAI*>(g->AI()))
smart = false;
if (!smart && !silent)