1
0
Fork 0

Fix trafific crash that was reported.

Probably an edge case of and edge case, but let's guard for it anyway,
since it causes traffic to terminate.

Sentry-Id: FLIGHTGEAR-2Q
This commit is contained in:
Automatic Release Builder 2020-09-28 09:43:21 +01:00 committed by James Turner
parent c75388f4b7
commit eb1d8a7dc8

View file

@ -1272,6 +1272,12 @@ void FGStartupController::updateAircraftInformation(int id, double lat, double l
int state = i->getState();
// Sentry FLIGHTGEAR-2Q : don't crash on null TrafficRef
if (!i->getAircraft()->getTrafficRef()) {
SG_LOG(SG_ATC, SG_ALERT, "AI traffic: updating aircraft without traffic ref");
return;
}
// The user controlled aircraft should have crased here, because it doesn't have a traffic reference.
// NOTE: if we create a traffic schedule for the user aircraft, we can use this to plan a flight.
time_t startTime = i->getAircraft()->getTrafficRef()->getDepartureTime();