[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

+6 -1
View File
@@ -1724,6 +1724,9 @@ void EntityList::QueueCloseClients(
for (auto &e : GetCloseMobList(sender, distance)) {
Mob *mob = e.second;
if (!mob) {
continue;
}
if (!mob->IsClient()) {
continue;
@@ -4416,6 +4419,9 @@ void EntityList::QuestJournalledSayClose(
if (RuleB(Chat, QuestDialogueUsesDialogueWindow)) {
for (auto &e : GetCloseMobList(sender, (dist * dist))) {
Mob *mob = e.second;
if (!mob) {
continue;
}
if (!mob->IsClient()) {
continue;
@@ -5551,7 +5557,6 @@ std::vector<Mob*> EntityList::GetTargetsForVirusEffect(Mob *spreader, Mob *origi
bool is_detrimental_spell = IsDetrimentalSpell(spell_id);
for (auto &it : entity_list.GetCloseMobList(spreader, range)) {
Mob *mob = it.second;
if (!mob) {
continue;
}