diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 9c7e9fde08..d8343a3f47 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -18,6 +18,7 @@ - Fix: [#12845] Deleting ride with active ad campaign creates incorrect notification. - Fix: [#12857] Incorrect Peep thoughts in imported RCT1 parks. - Fix: [#12881] Guests' favourite rides are not listed in the guest window. +- Fix: [#12910] Plugin API: getRide sometimes returns null for valid ride IDs. - Fix: Incomplete loop collision box allowed overlapping track (original bug). - Improved: [#12806] Add Esperanto diacritics to the sprite font. - Improved: [#12890] Add stroke to lowercase 'L' to differentiate from capital 'I'. diff --git a/src/openrct2/scripting/ScMap.hpp b/src/openrct2/scripting/ScMap.hpp index 5fbb28526f..560d460b66 100644 --- a/src/openrct2/scripting/ScMap.hpp +++ b/src/openrct2/scripting/ScMap.hpp @@ -67,13 +67,10 @@ namespace OpenRCT2::Scripting std::shared_ptr getRide(int32_t id) const { auto rideManager = GetRideManager(); - if (id >= 0 && id < static_cast(rideManager.size())) + auto ride = rideManager[static_cast(id)]; + if (ride != nullptr) { - auto ride = rideManager[static_cast(id)]; - if (ride != nullptr) - { - return std::make_shared(ride->id); - } + return std::make_shared(ride->id); } return {}; }