]> git.mxchange.org Git - flightgear.git/commitdiff
Runtime checks for GroundContoller crashes.
authorJames Turner <zakalawe@mac.com>
Fri, 18 Dec 2015 04:23:45 +0000 (20:23 -0800)
committerJames Turner <zakalawe@mac.com>
Fri, 18 Dec 2015 04:23:45 +0000 (20:23 -0800)
Trying to identify what’s actually going wrong here.

src/ATC/GroundController.cxx

index 1e25e971ad67d553b617bdc4ea3c9eacf3650b5e..23bb001a3909ca6f6993a825e650835679a32891 100644 (file)
@@ -970,6 +970,16 @@ void FGGroundController::updateStartupTraffic(TrafficVectorIterator i,
                                               int& priority,
                                               time_t now)
 {
+    if (!i->getAircraft()) {
+        SG_LOG(SG_ATC, SG_ALERT, "updateStartupTraffic: missing aircraft");
+        return;
+    }
+
+    if (!i->getAircraft()->getPerformance()) {
+        SG_LOG(SG_ATC, SG_ALERT, "updateStartupTraffic: missing aircraft performance");
+        return;
+    }
+
     i->allowPushBack();
     i->setPriority(priority++);
     // in meters per second;
@@ -980,6 +990,11 @@ void FGGroundController::updateStartupTraffic(TrafficVectorIterator i,
 
     FGGroundNetwork* network = dynamics->getGroundNetwork();
 
+    if (!network) {
+        SG_LOG(SG_ATC, SG_ALERT, "updateStartupTraffic: missing ground network");
+        return;
+    }
+
     // Check for all active aircraft whether it's current pos segment is
     // an opposite of one of the departing aircraft's intentions
     for (TrafficVectorIterator j = activeTraffic.begin(); j != activeTraffic.end(); j++) {
@@ -1024,13 +1039,24 @@ void FGGroundController::updateActiveTraffic(TrafficVectorIterator i,
                                              int& priority,
                                              time_t now)
 {
+    if (!i->getAircraft()) {
+        SG_LOG(SG_ATC, SG_ALERT, "updateActiveTraffic: missing aircraft");
+        return;
+    }
+
+    if (!i->getAircraft()->getPerformance()) {
+        SG_LOG(SG_ATC, SG_ALERT, "updateActiveTraffic: missing aircraft performance");
+        return;
+    }
 
-    assert(i->getAircraft());
-    assert(i->getAircraft()->getPerformance());
     double length = 0;
     double vTaxi = (i->getAircraft()->getPerformance()->vTaxi() * SG_NM_TO_METER) / 3600;
     FGGroundNetwork* network = dynamics->getGroundNetwork();
-    assert(network);
+
+    if (!network) {
+        SG_LOG(SG_ATC, SG_ALERT, "updateActiveTraffic: missing ground network");
+        return;
+    }
 
     i->setPriority(priority++);
     int pos = i->getCurrentPosition();