From 37816a0f0581dcc94c7c0fb2f2eb4d2a0cd08102 2015-07-07 10:06:58 From: Titta Heikkala Date: 2015-07-07 10:06:58 Subject: [PATCH] Fix axis animation crash ZoomInAnimation may cause 'index out of range' error if index is below zero. Ensured the index is valid. Change-Id: Ic7525f6fa609408b54e962b65f3f6151db2e03c8 Task-number: QTRD-3583 Reviewed-by: Marko Kangas --- diff --git a/src/charts/animations/axisanimation.cpp b/src/charts/animations/axisanimation.cpp index 7c45d3d..1be6bec 100644 --- a/src/charts/animations/axisanimation.cpp +++ b/src/charts/animations/axisanimation.cpp @@ -71,6 +71,8 @@ void AxisAnimation::setValues(QVector &oldLayout, QVector &newLayo int index = qMin(oldLayout.count() * (m_axis->axis()->orientation() == Qt::Horizontal ? m_point.x() : (1 - m_point.y())), newLayout.count() - (qreal)1.0); oldLayout.resize(newLayout.count()); + if (index < 0) + break; for (int i = 0; i < oldLayout.count(); i++) oldLayout[i] = oldLayout[index]; }