1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-22 15:23:01 +01:00

Fix #8834: Invalid read in UpdateRideApproachExitWaypoints

This commit is contained in:
Ted John
2019-03-09 11:36:53 +00:00
parent 057a27ad01
commit f5904c90cb

View File

@@ -4389,12 +4389,15 @@ void Guest::UpdateRideApproachExitWaypoints()
int16_t shift_multiplier = 20;
rct_ride_entry* ride_type = get_ride_entry(ride->subtype);
rct_ride_entry_vehicle* vehicle_entry = &ride_type->vehicles[ride_type->default_vehicle];
if (vehicle_entry->flags & (VEHICLE_ENTRY_FLAG_CHAIRLIFT | VEHICLE_ENTRY_FLAG_GO_KART))
auto rideEntry = get_ride_entry(ride->subtype);
if (rideEntry != nullptr)
{
auto vehicleEntry = &rideEntry->vehicles[rideEntry->default_vehicle];
if (vehicleEntry->flags & (VEHICLE_ENTRY_FLAG_CHAIRLIFT | VEHICLE_ENTRY_FLAG_GO_KART))
{
shift_multiplier = 32;
}
}
x_shift *= shift_multiplier;
y_shift *= shift_multiplier;