Fix #12910: Plugin API: getRide sometimes returns null for valid IDs

This commit is contained in:
Ted John 2020-09-12 11:18:24 +01:00 committed by GitHub
parent ed9c785573
commit eb18a5db81
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 6 deletions

View file

@ -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'.

View file

@ -67,13 +67,10 @@ namespace OpenRCT2::Scripting
std::shared_ptr<ScRide> getRide(int32_t id) const
{
auto rideManager = GetRideManager();
if (id >= 0 && id < static_cast<int32_t>(rideManager.size()))
auto ride = rideManager[static_cast<ride_id_t>(id)];
if (ride != nullptr)
{
auto ride = rideManager[static_cast<ride_id_t>(id)];
if (ride != nullptr)
{
return std::make_shared<ScRide>(ride->id);
}
return std::make_shared<ScRide>(ride->id);
}
return {};
}