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

Fix #14003: NPE in TryReconnectBoatToTrack()

This commit is contained in:
Michael Steenbeek
2023-01-14 23:21:03 +01:00
committed by GitHub
parent d1b0ef4ea1
commit f2b4d9dcf6

View File

@@ -4230,12 +4230,13 @@ void Vehicle::TryReconnectBoatToTrack(const CoordsXY& currentBoatLocation, const
TrackLocation.x = trackCoords.x;
TrackLocation.y = trackCoords.y;
auto trackElement = MapGetTrackElementAt(TrackLocation);
auto curRide = GetRide();
if (curRide != nullptr)
{
SetTrackType(trackElement->GetTrackType());
auto trackElement = MapGetTrackElementAt(TrackLocation);
if (trackElement != nullptr)
SetTrackType(trackElement->GetTrackType());
SetTrackDirection(curRide->boat_hire_return_direction);
BoatLocation.SetNull();
}