Traffic: work around crash with bad trafficRef
Don’t crash when the arrival airport is null. Sentry-Id: FLIGHTGEAR-893
This commit is contained in:
parent
4b9f903f8f
commit
1f24f1b2bb
1 changed files with 8 additions and 0 deletions
|
@ -1230,6 +1230,14 @@ bool FGAIAircraft::reachedEndOfCruise(double &distance) {
|
|||
}
|
||||
|
||||
if (curr->getName() == string("BOD")) {
|
||||
// Sentry: FLIGHTGEAR-893
|
||||
if (!trafficRef->getArrivalAirport()) {
|
||||
SG_LOG(SG_AI, SG_WARN, trafficRef->getCallSign() << "FGAIAircraft::reachedEndOfCruise: no arrival airport");
|
||||
setDie(true);
|
||||
// return 'done' here, we are broken
|
||||
return true;
|
||||
}
|
||||
|
||||
double dist = fp->getDistanceToGo(pos.getLatitudeDeg(), pos.getLongitudeDeg(), curr);
|
||||
double descentSpeed = (getPerformance()->vDescent() * SG_NM_TO_METER) / 3600.0; // convert from kts to meter/s
|
||||
double descentRate = (getPerformance()->descentRate() * SG_FEET_TO_METER) / 60.0; // convert from feet/min to meter/s
|
||||
|
|
Loading…
Reference in a new issue