[Crash] Pointer validation in mob iteration loops (#2490)

This commit is contained in:
Chris Miles
2022-10-15 15:10:11 -05:00
committed by GitHub
parent 05723ad1e8
commit bbbebdd346
7 changed files with 62 additions and 4 deletions
+3
View File
@@ -2284,6 +2284,9 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, CastingSlot slot, in
auto& mob_list = entity_list.GetCloseMobList(spell_target);
for (auto& e : mob_list) {
auto mob = e.second;
if (!mob) {
continue;
}
if (mob->IsNPC() && mob->CastToNPC()->IsGuard()) {
float distance = Distance(spell_target->GetPosition(), mob->GetPosition());
if ((mob->CheckLosFN(spell_target) || mob->CheckLosFN(this)) && distance <= 70) {