Fix #11166: Null pointer read in Guest::UpdateRideAdvanceThroughEntrance (#11182)

This commit is contained in:
Michael Steenbeek 2020-04-01 12:45:08 +02:00 committed by Michał Janiszewski
parent 63c11ab8fd
commit 3a47e3b309
1 changed files with 9 additions and 0 deletions

View File

@ -3728,9 +3728,18 @@ void Guest::UpdateRideAdvanceThroughEntrance()
}
Vehicle* vehicle = GET_VEHICLE(ride->vehicles[current_train]);
if (vehicle == nullptr)
{
return;
}
for (int32_t i = current_car; i != 0; --i)
{
vehicle = GET_VEHICLE(vehicle->next_vehicle_on_train);
if (vehicle == nullptr)
{
return;
}
}
ride_entry = get_ride_entry(vehicle->ride_subtype);