Fix dereference on null iterator (#11154)

This commit is contained in:
Tulio Leao 2020-03-30 14:05:38 -03:00 committed by GitHub
parent dbfb0e4bbe
commit 3d223b0843
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -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