From a45e3d1d0760d133cb9a25434fc8022674451e17 Mon Sep 17 00:00:00 2001 From: James Turner Date: Tue, 15 Oct 2013 22:27:19 +0100 Subject: [PATCH] Bug 1217, crash on AI traffic data. Guard against flight plans with missing airport information. --- src/GUI/MapWidget.cxx | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/GUI/MapWidget.cxx b/src/GUI/MapWidget.cxx index 7edb0c93e..c35c1e6fe 100644 --- a/src/GUI/MapWidget.cxx +++ b/src/GUI/MapWidget.cxx @@ -1572,10 +1572,15 @@ void MapWidget::drawAIAircraft(const SGPropertyNode* model, const SGGeod& pos, d if (aircraft) { FGAIAircraft* p = static_cast(aircraft.get()); if (p->GetFlightPlan()) { - originICAO = p->GetFlightPlan()->departureAirport()->ident(); - destinationICAO = p->GetFlightPlan()->arrivalAirport()->ident(); - } - } + if (p->GetFlightPlan()->departureAirport()) { + originICAO = p->GetFlightPlan()->departureAirport()->ident(); + } + + if (p->GetFlightPlan()->arrivalAirport()) { + destinationICAO = p->GetFlightPlan()->arrivalAirport()->ident(); + } + } // of flight-plan exists + } // of check for AIBase-derived instance // draw callsign / altitude / speed int altFt50 = static_cast(pos.getElevationFt() / 50.0) * 50; -- 2.39.5