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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions

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();
}