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

This commit is contained in:
Chris Miles authored and GitHub committed 2022-10-15 15:10:11 -05:00
1 parent 05723ad1e8
commit bbbebdd346
7 files changed
+62 -4

No files matched your search

+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) {