fix(Core/Spells): fix crash on non-unit targets in area target check (#27061)

This commit is contained in:
Andrew
2026-08-09 06:14:20 -03:00
committed by GitHub
parent e9c9336e0a
commit f8f667bff5
+4 -2
View File
@@ -9161,8 +9161,10 @@ namespace Acore
|| _referenceType == TARGET_REFERENCE_TYPE_TARGET)
{
float effectiveRange = _range;
if (_caster->IsControlledByPlayer() && !target->ToUnit()->IsControlledByPlayer())
effectiveRange += target->GetCombatReach();
// searcher also visits non-unit objects (corpses, dynobjects) when the spell can target them
if (Unit const* unitTarget = target->ToUnit())
if (_caster->IsControlledByPlayer() && !unitTarget->IsControlledByPlayer())
effectiveRange += unitTarget->GetCombatReach();
if (target->GetExactDist(_position) > effectiveRange)
return false;