diff --git a/src/openrct2/peep/Guest.cpp b/src/openrct2/peep/Guest.cpp index cd6c586b92..d81e728352 100644 --- a/src/openrct2/peep/Guest.cpp +++ b/src/openrct2/peep/Guest.cpp @@ -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);