mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-13 17:19:07 +00:00
fix(Core/SAI): Fix crash in SMART_TARGET_OWNER_OR_SUMMONER (#22789)
This commit is contained in:
@@ -3834,19 +3834,20 @@ void SmartScript::GetTargets(ObjectVector& targets, SmartScriptHolder const& e,
|
||||
{
|
||||
targets.clear();
|
||||
|
||||
if (owner->ToCreature())
|
||||
if (IsCreature(owner))
|
||||
{
|
||||
if (Unit* base = ObjectAccessor::GetUnit(*owner, owner->ToCreature()->GetCharmerOrOwnerGUID()))
|
||||
{
|
||||
targets.push_back(base);
|
||||
}
|
||||
}
|
||||
else
|
||||
else if (IsGameObject(owner))
|
||||
{
|
||||
if (Unit* base = ObjectAccessor::GetUnit(*owner, owner->ToGameObject()->GetOwnerGUID()))
|
||||
{
|
||||
targets.push_back(base);
|
||||
}
|
||||
}
|
||||
else if (IsPlayer(owner))
|
||||
{
|
||||
if (Unit* base = owner->ToPlayer()->GetCharmerOrOwner())
|
||||
targets.push_back(base);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user