From 5ce5f4fbac9f25d2c67ecab46c6ff1cae8652096 Mon Sep 17 00:00:00 2001 From: Gabriel Ozouf Date: Mon, 28 Dec 2020 16:19:16 +0100 Subject: [PATCH] [statistics] Fix glitch with histogram parameters In the window to change the histogram parameters, it was possible to set a rectangle width that was considered valid, but would make the starting abscissa invalid, while triggering no error message. The message would only show if the user closed the window and opened it again. e.g. : Set a series with only one value 1e10 Change its starting abscissa to 0 Change its rectangle width to 1, confirm and close the menu Re-open the menu, a message appears, and stays onscreen when leaving the menu. --- apps/statistics/histogram_parameter_controller.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/statistics/histogram_parameter_controller.cpp b/apps/statistics/histogram_parameter_controller.cpp index f7d538d0b..6da2c4737 100644 --- a/apps/statistics/histogram_parameter_controller.cpp +++ b/apps/statistics/histogram_parameter_controller.cpp @@ -90,7 +90,7 @@ bool HistogramParameterController::setParameterAtIndex(int parameterIndex, doubl // The number of bars cannot be above the max assert(DoublePairStore::k_numberOfSeries > 0); for (int i = 0; i < DoublePairStore::k_numberOfSeries; i++) { - const double min = setBarWidth ? m_store->minValue(i) : nextFirstDrawnBarAbscissa; + const double min = std::min(m_store->minValue(i), nextFirstDrawnBarAbscissa); double numberOfBars = std::ceil((m_store->maxValue(i) - min)/nextBarWidth); if (numberOfBars > Store::k_maxNumberOfBars) { Container::activeApp()->displayWarning(I18n::Message::ForbiddenValue);