1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-17 03:53:07 +01:00

Guard against accessing non-existant ride types

This commit is contained in:
Gymnasiast
2021-02-14 22:32:03 +01:00
parent 92dc3f4aa9
commit 81fbe27dcb

View File

@@ -805,7 +805,8 @@ public:
dst.State = src.state;
if (src.proximity_track_type == 0xFF)
dst.ProximityTrackType = TrackElemType::None;
else if (src.current_ride < RCT12_MAX_RIDES_IN_PARK)
else if (
src.current_ride < RCT12_MAX_RIDES_IN_PARK && _s6.rides[src.current_ride].type < std::size(RideTypeDescriptors))
dst.ProximityTrackType = RCT2TrackTypeToOpenRCT2(src.proximity_track_type, _s6.rides[src.current_ride].type);
else
dst.ProximityTrackType = src.proximity_track_type;