diff --git a/distribution/changelog.txt b/distribution/changelog.txt index ec1d929eaf..048986656a 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -17,6 +17,7 @@ - Fix: [#11005] Company value overflows. - Fix: [#11027] Third color on walls becomes black when saving. - Fix: [#11063] Scrolling position persists when switching tabs in the scenery window. +- Fix: [#11106] Crash on getting invalid vehicle index. - Fix: [#11126] Cannot place Frightmare track design. - Fix: [#11208] Cannot export parks with RCT2 DLC objects. - Fix: [#11230] Seat Rotation not imported correctly for hacked rides. diff --git a/src/openrct2/ride/Vehicle.cpp b/src/openrct2/ride/Vehicle.cpp index bf787b2b8b..7d2853d91a 100644 --- a/src/openrct2/ride/Vehicle.cpp +++ b/src/openrct2/ride/Vehicle.cpp @@ -6224,6 +6224,8 @@ Vehicle* vehicle_get_head(const Vehicle* vehicle) for (;;) { + if (vehicle->prev_vehicle_on_ride > MAX_SPRITES) + return nullptr; prevVehicle = GET_VEHICLE(vehicle->prev_vehicle_on_ride); if (prevVehicle->next_vehicle_on_train == SPRITE_INDEX_NULL) break;