From 98798c1e426a1e156c7dc5042a3843aed360956b Mon Sep 17 00:00:00 2001 From: Neil Horne Date: Sun, 15 May 2016 04:16:42 +1000 Subject: [PATCH] Fixes #3459 Rotary encoders linked flight mode can freeze Companion (#3470) --- companion/src/modeledit/flightmodes.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/companion/src/modeledit/flightmodes.cpp b/companion/src/modeledit/flightmodes.cpp index c01b540c0..adb162423 100644 --- a/companion/src/modeledit/flightmodes.cpp +++ b/companion/src/modeledit/flightmodes.cpp @@ -229,8 +229,9 @@ void FlightModePanel::update() int idx = phase.rotaryEncoders[i]; FlightModeData *phasere = &phase; while (idx > 1024) { - idx -= 1025; - phasere = &model->flightModeData[idx]; + int nextPhase = idx - 1025; + if (nextPhase >= phaseIdx) nextPhase += 1; + phasere = &model->flightModeData[nextPhase]; idx = phasere->rotaryEncoders[i]; reValues[i]->setDisabled(true); }