From e4a2b1f9c5e83cd6cc3c3bfd8f73e5cba02d351f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CE=B6eh=20Matt?= Date: Thu, 3 Oct 2019 23:08:40 +0200 Subject: [PATCH] Fix #9953: Crash when hacked rides attempt to find the closest mechanic --- distribution/changelog.txt | 1 + src/openrct2/ride/Station.cpp | 2 ++ 2 files changed, 3 insertions(+) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 3140844ac6..3d1b7825e6 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -21,6 +21,7 @@ - Fix: [#9729] Peeps do not take into account height difference when deciding to pathfind to a ride entrance (original bug). - Fix: [#9902] Doors/Portcullis do not check to make sure doors are open causing double opens. - Fix: [#9926] Africa - Oasis park has wrong peep spawn (original bug). +- Fix: [#9953] Crash when hacked rides attempt to find the closest mechanic. - Fix: [#9955] Resizing map in while pause mode does not work and may result in freezes. - Fix: [#9957] When using 'no money' cheat, guests complain of running out of cash. - Fix: [#9970] Wait for quarter load fails. diff --git a/src/openrct2/ride/Station.cpp b/src/openrct2/ride/Station.cpp index 9d00fe345f..2cde4e11b4 100644 --- a/src/openrct2/ride/Station.cpp +++ b/src/openrct2/ride/Station.cpp @@ -356,6 +356,8 @@ TileElement* ride_get_station_exit_element(int32_t x, int32_t y, int32_t z) TileElement* tileElement = map_get_first_element_at(x, y); do { + if (tileElement == nullptr) + break; if (tileElement->GetType() == TILE_ELEMENT_TYPE_ENTRANCE && z == tileElement->base_height) return tileElement; } while (!(tileElement++)->IsLastForTile());