From: James Turner Date: Tue, 26 Jun 2012 14:16:03 +0000 (+0100) Subject: Fix an edge case in flight-plan inserts. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=20071b66afd467bc87acea2e2c42cff90757f743;p=flightgear.git Fix an edge case in flight-plan inserts. When inserting with an invalid index, ensure we return the leg based on the fixed-up index, not the original one. Thanks to Matthias Götz for the catch! --- diff --git a/src/Navaids/FlightPlan.cxx b/src/Navaids/FlightPlan.cxx index 5f5ba5e71..b5ff28b45 100644 --- a/src/Navaids/FlightPlan.cxx +++ b/src/Navaids/FlightPlan.cxx @@ -148,7 +148,7 @@ FlightPlan::Leg* FlightPlan::insertWayptAtIndex(Waypt* aWpt, int aIndex) } insertWayptsAtIndex(wps, index); - return legAtIndex(aIndex); + return legAtIndex(index); } void FlightPlan::insertWayptsAtIndex(const WayptVec& wps, int aIndex)