1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-24 08:12:53 +01:00

Fix crash caused by bad pointers

This commit is contained in:
duncanspumpkin
2020-04-18 11:41:05 +01:00
parent f9ae3dd980
commit b81f6d0bed

View File

@@ -410,8 +410,14 @@ void peep_update_all()
if (gScreenFlags & SCREEN_FLAGS_EDITOR)
return;
FOR_ALL_PEEPS (spriteIndex, peep)
// Do not use the FOR_ALL_PEEPS macro for this as next sprite index
// will be fetched on a delted peep if peep leaves the park.
for (spriteIndex = gSpriteListHead[SPRITE_LIST_PEEP]; spriteIndex != SPRITE_INDEX_NULL;)
{
peep = GET_PEEP(spriteIndex);
spriteIndex = peep->next;
if ((uint32_t)(i & 0x7F) != (gCurrentTicks & 0x7F))
{
peep->Update();