]> git.mxchange.org Git - flightgear.git/commitdiff
Bug 1217, crash on AI traffic data.
authorJames Turner <zakalawe@mac.com>
Tue, 15 Oct 2013 21:27:19 +0000 (22:27 +0100)
committerJames Turner <zakalawe@mac.com>
Tue, 15 Oct 2013 21:27:19 +0000 (22:27 +0100)
Guard against flight plans with missing airport
information.

src/GUI/MapWidget.cxx

index 7edb0c93e5dc72c4fdf9794270ed6f3c35c4021a..c35c1e6fe26cfad8b983eec7bf6276ec7413a349 100644 (file)
@@ -1572,10 +1572,15 @@ void MapWidget::drawAIAircraft(const SGPropertyNode* model, const SGGeod& pos, d
     if (aircraft) {
         FGAIAircraft* p = static_cast<FGAIAircraft*>(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<int>(pos.getElevationFt() / 50.0) * 50;