From d022231a3ab4e32f6e0dc783790da85e1588bc25 Mon Sep 17 00:00:00 2001 From: Gabriel Ozouf Date: Mon, 4 Jan 2021 15:19:24 +0100 Subject: [PATCH] [statistics] Fix use of uninitialized variable --- apps/statistics/histogram_parameter_controller.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/statistics/histogram_parameter_controller.cpp b/apps/statistics/histogram_parameter_controller.cpp index f057c922f..3ba5cff2b 100644 --- a/apps/statistics/histogram_parameter_controller.cpp +++ b/apps/statistics/histogram_parameter_controller.cpp @@ -26,8 +26,12 @@ HistogramParameterController::HistogramParameterController(Responder * parentRes void HistogramParameterController::viewWillAppear() { // Initialize temporary parameters to the extracted value. + /* setParameterAtIndex uses the value of the other parameter, so we need to + * manually set the value of the second parameter before the first call. */ + double parameterAtIndex1 = extractParameterAtIndex(1); + m_tempFirstDrawnBarAbscissa = parameterAtIndex1; setParameterAtIndex(0, extractParameterAtIndex(0)); - setParameterAtIndex(1, extractParameterAtIndex(1)); + setParameterAtIndex(1, parameterAtIndex1); FloatParameterController::viewWillAppear(); }