From 9ebbfb90af5c9e7d9ee700be9b4819e11cda104f Mon Sep 17 00:00:00 2001 From: James Turner Date: Fri, 23 Oct 2020 14:47:08 +0100 Subject: [PATCH] Traffic: Fix crash in createTakeoff MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Likely relates to repositioning, and a stale ‘active runway’ value. --- src/AIModel/AIFlightPlanCreate.cxx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/AIModel/AIFlightPlanCreate.cxx b/src/AIModel/AIFlightPlanCreate.cxx index 628034ebb..43d109cf0 100644 --- a/src/AIModel/AIFlightPlanCreate.cxx +++ b/src/AIModel/AIFlightPlanCreate.cxx @@ -531,6 +531,13 @@ bool FGAIFlightPlan::createTakeOff(FGAIAircraft * ac, bool firstFlight, apt->getDynamics()->getActiveRunway(rwyClass, 1, activeRunway, heading); } + + // this is Sentry issue FLIGHTGEAR-DS : happens after reposition, + // likely firstFlight is false, but activeRunway is stale + if (!apt->hasRunwayWithIdent(activeRunway)) { + SG_LOG(SG_AI, SG_WARN, "FGAIFlightPlan::createTakeOff: invalid active runway:" << activeRunway); + return false; + } FGRunway * rwy = apt->getRunwayByIdent(activeRunway); if (!rwy)