forked from rosebudai/OpenRCT2-Web
Fix bounds check in RideGetVehicleColour (#26111)
This commit is contained in:
1 parent
22ba13e21a
commit
485e882e15
2 files changed
+2
-1
No files matched your search
@@ -1,5 +1,6 @@
|
||||
0.4.33 (in development)
|
||||
------------------------------------------------------------------------
|
||||
- Fix: [#26111] Vehicle colours tab can go out of bounds in certain edge cases.
|
||||
|
||||
0.4.32 (2026-03-01)
|
||||
------------------------------------------------------------------------
|
||||
|
||||
@@ -2207,7 +2207,7 @@ std::pair<RideMeasurement*, OpenRCT2String> Ride::getMeasurement()
|
||||
VehicleColour RideGetVehicleColour(const Ride& ride, int32_t vehicleIndex)
|
||||
{
|
||||
// Prevent indexing array out of bounds
|
||||
vehicleIndex = std::min<int32_t>(vehicleIndex, static_cast<int32_t>(std::size(ride.vehicleColours)));
|
||||
vehicleIndex = std::clamp<int32_t>(vehicleIndex, 0, std::size(ride.vehicleColours) - 1);
|
||||
return ride.vehicleColours[vehicleIndex];
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user