diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 17aaa9fb6e..c5cc0256d6 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -40,6 +40,7 @@ - Fix: [#8358] Infinite loop when changing vehicle count on stopped ride. - Fix: [#8433] Crash if master server response is not valid JSON. - Fix: [#8434] Crash if curl_easy_init fails. +- Fix: [#8443] Crash when selecting the current vehicle for ride that has none available. - Improved: [#2940] Allow mouse-dragging to set patrol area (Singleplayer only). - Improved: [#7730] Draw extreme vertical and lateral Gs red in the ride window's graph tab. - Improved: [#7930] Automatically create folders for custom content. diff --git a/src/openrct2-ui/windows/Ride.cpp b/src/openrct2-ui/windows/Ride.cpp index 2441d874ed..ef1c88c944 100644 --- a/src/openrct2-ui/windows/Ride.cpp +++ b/src/openrct2-ui/windows/Ride.cpp @@ -2883,8 +2883,11 @@ static void window_ride_vehicle_dropdown(rct_window* w, rct_widgetindex widgetIn switch (widgetIndex) { case WIDX_VEHICLE_TYPE_DROPDOWN: - int32_t newRideType = VehicleDropdownData[dropdownIndex].subtype_id; - ride_set_ride_entry(w->number, newRideType); + if (dropdownIndex >= 0 && static_cast(dropdownIndex) < VehicleDropdownData.size()) + { + int32_t newRideType = VehicleDropdownData[dropdownIndex].subtype_id; + ride_set_ride_entry(w->number, newRideType); + } break; } }