From 569161902f9b02c3674461e4bcb791a02b3e661e Mon Sep 17 00:00:00 2001 From: Ted John Date: Wed, 27 Nov 2019 20:45:32 +0000 Subject: [PATCH] Fix #9919: invalid read in vehicle_update_measurements (#10300) --- src/openrct2/ride/Vehicle.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/openrct2/ride/Vehicle.cpp b/src/openrct2/ride/Vehicle.cpp index 3a3bed85d7..985bac5048 100644 --- a/src/openrct2/ride/Vehicle.cpp +++ b/src/openrct2/ride/Vehicle.cpp @@ -1537,8 +1537,10 @@ static void vehicle_update_measurements(rct_vehicle* vehicle) return; } - uint8_t stationId = ride->current_test_station; - if (!ride_get_entrance_location(ride, stationId).isNull()) + if (ride->current_test_station == 0xFF) + return; + + if (!ride_get_entrance_location(ride, ride->current_test_station).isNull()) { uint8_t test_segment = ride->current_test_segment;