From ccf674e18978db0583895020ddd91cc0046157f5 Mon Sep 17 00:00:00 2001 From: portree_kid Date: Wed, 23 Nov 2022 14:37:30 +0100 Subject: [PATCH] AI Prevent Segfault when aircraft gets bogus flightplan --- src/AIModel/AIAircraft.cxx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/AIModel/AIAircraft.cxx b/src/AIModel/AIAircraft.cxx index 87011bccd..d8765bee1 100644 --- a/src/AIModel/AIAircraft.cxx +++ b/src/AIModel/AIAircraft.cxx @@ -327,7 +327,12 @@ void FGAIAircraft::ProcessFlightPlan( double dt, time_t now ) { // Initialize the flightplan ////////////////////////////////////////////////////////////////////////// if (!prev||repositioned) { - handleFirstWaypoint(); + if (!fp->empty()) { + handleFirstWaypoint(); + } else { + SG_LOG(SG_AI, SG_WARN, getCallSign() << " didn't have a valid flightplan and was killed"); + setDie(true); + } return; } // end of initialization if (!fpExecutable(now)) {