1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-22 06:23:04 +01:00

Fix #11106: Crash on getting invalid vehicle index (#11305)

* Fix #11106: Fix crash on bad value prev_vehicle

This allows Thorpe Park to be loaded again. This is ultimately not a great fix. In the future it should be made so that the vehicle pointers are validated on load to ensure there are no loops or bad values.
This commit is contained in:
Duncan
2020-04-16 22:24:07 +01:00
committed by GitHub
parent d8994920f8
commit 92449773c5
2 changed files with 3 additions and 0 deletions

View File

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

View File

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