From 6961daf29fe74947df260232fb82c0247629a9eb 2016-04-05 07:50:00 From: Miikka Heikkinen Date: 2016-04-05 07:50:00 Subject: [PATCH] Fix crash when axis range is infinite. Now instead print out a warning and ignore the invalid range. Task-number: QTBUG-52320 Change-Id: I929f8f61eecaa23a0c61d143c5fa2e8431160d3f Reviewed-by: Mika Salmela Reviewed-by: Tomi Korpipää Reviewed-by: Miikka Heikkinen --- diff --git a/src/charts/axis/valueaxis/qvalueaxis.cpp b/src/charts/axis/valueaxis/qvalueaxis.cpp index fec95fd..a8c2703 100644 --- a/src/charts/axis/valueaxis/qvalueaxis.cpp +++ b/src/charts/axis/valueaxis/qvalueaxis.cpp @@ -29,7 +29,7 @@ #include #include #include - +#include QT_CHARTS_BEGIN_NAMESPACE /*! @@ -382,6 +382,12 @@ void QValueAxisPrivate::setRange(qreal min, qreal max) if (min > max) return; + if (!isValidValue(min, max)) { + qWarning() << "Attempting to set invalid range for value axis: [" + << min << " - " << max << "]"; + return; + } + bool changeMin = false; if (m_min == 0 || min == 0) changeMin = !qFuzzyCompare(1 + m_min, 1 + min);