Bug 1176, crash loading malformed scenario.
http://code.google.com/p/flightgear-bugs/issues/detail?id=1176 Don't crash if a scenario specifies a missing or invalid flightplan (check the flightplan is valid before setting it)
This commit is contained in:
parent
cc37e31ac9
commit
f5b352429c
1 changed files with 11 additions and 3 deletions
|
@ -235,11 +235,19 @@ double FGAIAircraft::sign(double x) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void FGAIAircraft::setFlightPlan(const std::string& flightplan, bool repeat) {
|
void FGAIAircraft::setFlightPlan(const std::string& flightplan, bool repeat)
|
||||||
if (!flightplan.empty()) {
|
{
|
||||||
FGAIFlightPlan* fp = new FGAIFlightPlan(flightplan);
|
if (flightplan.empty()) {
|
||||||
|
SG_LOG(SG_AI, SG_WARN, "setFlightPlan: empty flight plan");
|
||||||
|
}
|
||||||
|
|
||||||
|
FGAIFlightPlan* fp = new FGAIFlightPlan(flightplan);
|
||||||
|
if (fp->isValidPlan()) {
|
||||||
fp->setRepeat(repeat);
|
fp->setRepeat(repeat);
|
||||||
SetFlightPlan(fp);
|
SetFlightPlan(fp);
|
||||||
|
} else {
|
||||||
|
SG_LOG(SG_AI, SG_WARN, "setFlightPlan: invalid flightplan specified:" << flightplan);
|
||||||
|
delete fp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue