1
0
Fork 0

Traffic: fix some crashes detected by Sentry

Sentry-Id: FLIGHTGEAR-68
Sentry-Id: FLIGHTGEAR-67
This commit is contained in:
Automatic Release Builder 2020-10-06 19:53:10 +01:00 committed by James Turner
parent f4f261a068
commit 38f44e0928
2 changed files with 13 additions and 8 deletions

View file

@ -1235,7 +1235,7 @@ void FGAIAircraft::updateVerticalSpeedTarget(double dt) {
} else {
tgt_vs = std::max(tgt_altitude_ft - altitude_ft, -_performance->descentRate());
}
} else if (fp) {
} else if (fp->getCurrentWaypoint()) {
double vert_dist_ft = fp->getCurrentWaypoint()->getCrossat() - altitude_ft;
double err_dist = 0; //prev->getCrossat() - altitude_ft;
double dist_m = fp->getDistanceToGo(pos.getLatitudeDeg(), pos.getLongitudeDeg(), fp->getCurrentWaypoint());
@ -1252,9 +1252,13 @@ void FGAIAircraft::updateVerticalSpeedTarget(double dt) {
if (fabs(tgt_vs) < fabs(min_vs))
tgt_vs = min_vs;*/
//cerr << "target vs : after " << tgt_vs << endl;
} else {
// avoid crashes when fp has no current waypoint
// eg see FLIGHTGEAR-68 on sentry; we crashed in getCrossat()
tgt_vs = 0.0;
}
} //else
// tgt_vs = 0.0;
}
checkTcas();
}

View file

@ -617,10 +617,10 @@ bool FGAIFlightPlan::createClimb(FGAIAircraft * ac, bool firstFlight,
//cerr << " Cloning waypoint " << endl;
}
} else {
FGRunway* runway = apt->getRunwayByIdent(activeRunway);
if (!runway)
if (!apt->hasRunwayWithIdent(activeRunway))
return false;
FGRunwayRef runway = apt->getRunwayByIdent(activeRunway);
SGGeod cur = runway->end();
if (!waypoints.empty()) {
cur = waypoints.back()->getPos();
@ -661,10 +661,11 @@ bool FGAIFlightPlan::createDescent(FGAIAircraft * ac, FGAirport * apt,
double heading = ac->getTrafficRef()->getCourse();
apt->getDynamics()->getActiveRunway(rwyClass, 2, activeRunway,
heading);
FGRunway * rwy = apt->getRunwayByIdent(activeRunway);
if (!rwy)
if (!apt->hasRunwayWithIdent(activeRunway))
return false;
FGRunwayRef rwy = apt->getRunwayByIdent(activeRunway);
// Create a slow descent path that ends 250 lateral to the runway.
double initialTurnRadius = getTurnRadius(vDescent, true);
//double finalTurnRadius = getTurnRadius(vApproach, true);