From 3d223b08431f10e78cb0d2911b7c4e5a6449f689 Mon Sep 17 00:00:00 2001 From: Tulio Leao Date: Mon, 30 Mar 2020 14:05:38 -0300 Subject: [PATCH] Fix dereference on null iterator (#11154) --- src/openrct2/actions/PlacePeepSpawnAction.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/openrct2/actions/PlacePeepSpawnAction.hpp b/src/openrct2/actions/PlacePeepSpawnAction.hpp index 59f589158d..fbbcbe5c12 100644 --- a/src/openrct2/actions/PlacePeepSpawnAction.hpp +++ b/src/openrct2/actions/PlacePeepSpawnAction.hpp @@ -101,9 +101,9 @@ public: // If we have reached our max peep spawns, remove the oldest spawns while (gPeepSpawns.size() >= MAX_PEEP_SPAWNS) { - auto oldestSpawn = gPeepSpawns.begin(); - gPeepSpawns.erase(oldestSpawn); - map_invalidate_tile_full(*oldestSpawn); + PeepSpawn oldestSpawn = *gPeepSpawns.begin(); + gPeepSpawns.erase(gPeepSpawns.begin()); + map_invalidate_tile_full(oldestSpawn); } // Shift the spawn point to the edge of the tile