RouteManager: validate changes to current-wp
Since FlightPlan::setCurrentIndex throws, ensure we validate the value coming from the property before setting it. Sentry-Id: FLIGHTGEAR-71
This commit is contained in:
parent
4c3aa8b484
commit
e0bd74e982
1 changed files with 8 additions and 0 deletions
|
@ -805,6 +805,14 @@ void FGRouteMgr::jumpToIndex(int index)
|
|||
if (!_plan) {
|
||||
return;
|
||||
}
|
||||
|
||||
// this method is tied() to current-wp property, but FlightPlan::setCurrentIndex
|
||||
// will throw on invalid input, so guard against invalid values here.
|
||||
// See Sentry FLIGHTGEAR-71
|
||||
if ((index < -1) || (index >= _plan->numLegs())) {
|
||||
SG_LOG(SG_AUTOPILOT, SG_WARN, "FGRouteMgr::jumpToIndex: ignoring invalid index:" << index);
|
||||
return;
|
||||
}
|
||||
|
||||
_plan->setCurrentIndex(index);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue