diff --git a/apps/graph/values/values_controller.cpp b/apps/graph/values/values_controller.cpp index 98eb2862a..d5783efce 100644 --- a/apps/graph/values/values_controller.cpp +++ b/apps/graph/values/values_controller.cpp @@ -237,10 +237,10 @@ int ValuesController::numberOfValuesColumns() { ContinuousFunction::PlotType ValuesController::plotTypeAtColumn(int * i) const { int plotTypeIndex = 0; - while (plotTypeIndex < ContinuousFunction::k_numberOfPlotTypes && *i >= numberOfColumnsForPlotType(plotTypeIndex)) { + while (*i >= numberOfColumnsForPlotType(plotTypeIndex)) { *i -= numberOfColumnsForPlotType(plotTypeIndex++); + assert(plotTypeIndex < ContinuousFunction::k_numberOfPlotTypes); } - assert(plotTypeIndex < ContinuousFunction::k_numberOfPlotTypes); return static_cast(plotTypeIndex); }