From 90f14626f516f4e0291a214ff036f9fa2835cf89 Mon Sep 17 00:00:00 2001 From: James Turner Date: Thu, 2 Sep 2021 11:11:23 +0100 Subject: [PATCH] Guard against a possible crash in TowerController --- src/ATC/trafficcontrol.cxx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/ATC/trafficcontrol.cxx b/src/ATC/trafficcontrol.cxx index 7326e1b61..0e168d593 100644 --- a/src/ATC/trafficcontrol.cxx +++ b/src/ATC/trafficcontrol.cxx @@ -1027,10 +1027,13 @@ void FGTowerController::updateAircraftInformation(int id, double lat, double lon } */ // only bother with aircraft that have a takeoff status of 2, since those are essentially under tower control FGAIAircraft* ac= rwy->getFirstAircraftIndepartureQueue(); - if (ac->getTakeOffStatus() == 1) { - // transmit takeoff clearance - ac->setTakeOffStatus(2); + if (ac) { + if (ac->getTakeOffStatus() == 1) { + // transmit takeoff clearance + ac->setTakeOffStatus(2); + } } + if (current.getAircraft()->getTakeOffStatus() == 2) { current.setHoldPosition(false); } else {