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

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
2 changed files with 4 additions and 6 deletions

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 {};
}