diff --git a/src/charts/axis/barcategoryaxis/chartbarcategoryaxisx.cpp b/src/charts/axis/barcategoryaxis/chartbarcategoryaxisx.cpp index 819f3a5..00db60e 100644 --- a/src/charts/axis/barcategoryaxis/chartbarcategoryaxisx.cpp +++ b/src/charts/axis/barcategoryaxis/chartbarcategoryaxisx.cpp @@ -70,7 +70,7 @@ QStringList ChartBarCategoryAxisX::createCategoryLabels(const QVector& la for (int i = 0; i < layout.count() - 1; ++i) { qreal x = qFloor((((layout[i] + layout[i + 1]) / 2 - gridRect.left()) * d + min() + 0.5)); - if (x < max() && (x >= 0)) { + if (x < max() && (x >= 0) && x < m_categoriesAxis->categories().count()) { result << m_categoriesAxis->categories().at(x); } else { // No label for x coordinate