]> git.mxchange.org Git - flightgear.git/commitdiff
Avoid a segfault-on-null
authorJames Turner <zakalawe@mac.com>
Sun, 23 Sep 2012 22:07:00 +0000 (23:07 +0100)
committerJames Turner <zakalawe@mac.com>
Sun, 23 Sep 2012 22:07:00 +0000 (23:07 +0100)
This code is called both when there's no ground-net, but also when there's no parking data at all.

src/AIModel/AIFlightPlanCreate.cxx

index a9dfb15fe152b240aed88a5f47999d462890e30d..80629ac281e38190a249eb58513f330e6634d926 100644 (file)
@@ -355,9 +355,11 @@ void FGAIFlightPlan::createDefaultLandingTaxi(FGAIAircraft * ac,
     pushBackWaypoint(wpt);
 
     FGParking* parkPos = aAirport->getDynamics()->getParking(gateId);
-    wpt = createOnGround(ac, "ENDtaxi", parkPos->getGeod(), airportElev,
+    if (parkPos) {
+        wpt = createOnGround(ac, "ENDtaxi", parkPos->getGeod(), airportElev,
                          ac->getPerformance()->vTaxi());
-    pushBackWaypoint(wpt);
+        pushBackWaypoint(wpt);
+    }
 }
 
 bool FGAIFlightPlan::createLandingTaxi(FGAIAircraft * ac, FGAirport * apt,