]> git.mxchange.org Git - flightgear.git/blobdiff - src/AIModel/AIFlightPlanCreate.cxx
Don't restore initial screen geometry because there is nothing in fg_os* to resize...
[flightgear.git] / src / AIModel / AIFlightPlanCreate.cxx
index 296a5920cae4f9b8ceb56c49c10ade29b84dbe92..9a2b81561fb7434a1c4c7b5863ed1e009c6a2253 100644 (file)
@@ -303,7 +303,9 @@ void FGAIFlightPlan::createTaxi(bool firstFlight, int direction,
              isPushBackPoint = true;
              int nrWaypoints = route.size();
              int nrWaypointsToSkip = rand() % nrWaypoints;
-             for (int i = 0; i < nrWaypointsToSkip; i++) {
+             // but make sure we always keep two active waypoints
+             // to prevent a segmentation fault
+             for (int i = 0; i < nrWaypointsToSkip-2; i++) {
                isPushBackPoint = false;
                route.next(&node);
              }