From c76d106e64de974290d116089d890efc8462ca75 Mon Sep 17 00:00:00 2001 From: James Turner Date: Thu, 17 Dec 2015 20:23:45 -0800 Subject: [PATCH] Runtime checks for GroundContoller crashes. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Trying to identify what’s actually going wrong here. --- src/ATC/GroundController.cxx | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/src/ATC/GroundController.cxx b/src/ATC/GroundController.cxx index 1e25e971a..23bb001a3 100644 --- a/src/ATC/GroundController.cxx +++ b/src/ATC/GroundController.cxx @@ -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();