Fix #6870 Crash when loading groena lund

This crash only occurs when the option "no test crashes" was enable. With this commit the sprite index will be checked before the vehicle gets checked.
This commit is contained in:
Hielke Morsink 2018-03-09 23:39:53 +01:00 committed by Duncan
parent 8cf8db01d3
commit 4bfeaf0c72
1 changed files with 5 additions and 1 deletions

View File

@ -2074,7 +2074,11 @@ static void ride_update(sint32 rideIndex)
if (ride->status == RIDE_STATUS_TESTING && gConfigGeneral.no_test_crashes) {
for (sint32 i = 0; i < ride->num_vehicles; i++) {
rct_vehicle *vehicle = GET_VEHICLE(ride->vehicles[i]);
uint16 spriteIndex = ride->vehicles[i];
if (spriteIndex == SPRITE_INDEX_NULL)
continue;
rct_vehicle *vehicle = GET_VEHICLE(spriteIndex);
if (vehicle->status == VEHICLE_STATUS_CRASHED || vehicle->status == VEHICLE_STATUS_CRASHING) {
ride_set_status(rideIndex, RIDE_STATUS_CLOSED);