From: James Turner Date: Fri, 18 Dec 2015 04:23:45 +0000 (-0800) Subject: Runtime checks for GroundContoller crashes. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=c76d106e64de974290d116089d890efc8462ca75;p=flightgear.git Runtime checks for GroundContoller crashes. Trying to identify what’s actually going wrong here. --- 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();