mirror of
https://github.com/liyunfan1223/azerothcore-wotlk.git
synced 2026-08-08 15:58:04 +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();
|
targets.clear();
|
||||||
|
|
||||||
if (owner->ToCreature())
|
if (IsCreature(owner))
|
||||||
{
|
{
|
||||||
if (Unit* base = ObjectAccessor::GetUnit(*owner, owner->ToCreature()->GetCharmerOrOwnerGUID()))
|
if (Unit* base = ObjectAccessor::GetUnit(*owner, owner->ToCreature()->GetCharmerOrOwnerGUID()))
|
||||||
{
|
|
||||||
targets.push_back(base);
|
targets.push_back(base);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else if (IsGameObject(owner))
|
||||||
{
|
{
|
||||||
if (Unit* base = ObjectAccessor::GetUnit(*owner, owner->ToGameObject()->GetOwnerGUID()))
|
if (Unit* base = ObjectAccessor::GetUnit(*owner, owner->ToGameObject()->GetOwnerGUID()))
|
||||||
{
|
|
||||||
targets.push_back(base);
|
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