1
0
Fork 0

Fix a potential segmentation fault and turn it into a harmless message.

This commit is contained in:
Erik Hofman 2017-01-14 10:37:42 +01:00
parent ed4a9337d9
commit 1ef1d5ad43

View file

@ -930,7 +930,12 @@ RoutePath::RoutePath(const flightgear::FlightPlan* fp) :
d(new RoutePathPrivate) d(new RoutePathPrivate)
{ {
for (int l=0; l<fp->numLegs(); ++l) { for (int l=0; l<fp->numLegs(); ++l) {
d->waypoints.push_back(WayptData(fp->legAtIndex(l)->waypoint())); Waypt *wpt = fp->legAtIndex(l)->waypoint();
if (!wpt) {
SG_LOG(SG_NAVAID, SG_ALERT, "Waypoint " << l << " of " << fp->numLegs() << "is NULL");
break;
}
d->waypoints.push_back(WayptData(wpt));
} }
d->aircraftCategory = fp->icaoAircraftCategory()[0]; d->aircraftCategory = fp->icaoAircraftCategory()[0];