From 28b7d17dfc1b50d2851bf25c0700f849a6bd2346 Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Tue, 18 Jan 2022 12:25:01 +0000 Subject: [PATCH] Prevent flightgear crash when clearing discontinuity in empty plan --- Nasal/FMGC/flightplan.nas | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Nasal/FMGC/flightplan.nas b/Nasal/FMGC/flightplan.nas index 97cd4156..c9cc2e91 100644 --- a/Nasal/FMGC/flightplan.nas +++ b/Nasal/FMGC/flightplan.nas @@ -761,6 +761,9 @@ var flightPlanController = { if (!me.temporaryFlag[plan]) { if (text == "CLR" and me.flightplans[2].getWP(index).wp_name == "DISCONTINUITY") { + if (me.flightplans[2].getPlanSize() == 3 and me.flightplans[2].departure_runway == nil and me.flightplans[2].destination_runway == nil and index == 1) { + return 1; + } var thePlan = 2; } else { fmgc.flightPlanController.createTemporaryFlightPlan(plan);