Fix #14003: NPE in TryReconnectBoatToTrack()

This commit is contained in:
Michael Steenbeek authored and GitHub committed 2023-01-14 22:21:03 +00:00
1 parent d1b0ef4ea1
commit f2b4d9dcf6
1 file changed
+4 -3
+4 -3
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();
}