-void FGAIAircraft::setFlightPlan(const std::string& flightplan, bool repeat) {
- if (!flightplan.empty()) {
- FGAIFlightPlan* fp = new FGAIFlightPlan(flightplan);
+void FGAIAircraft::setFlightPlan(const std::string& flightplan, bool repeat)
+{
+ if (flightplan.empty()) {
+ // this is the case for Nasal-scripted aircraft
+ return;
+ }
+
+ FGAIFlightPlan* fp = new FGAIFlightPlan(flightplan);
+ if (fp->isValidPlan()) {