From 08ad63c8a2c5d0ba5dd3c748f6c08fc8bcc48fec Mon Sep 17 00:00:00 2001 From: David Faure Date: Thu, 4 Apr 2024 16:58:39 +0200 Subject: [PATCH] Avoid crash when m_costs is empty --- core/paintbuffermodel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/paintbuffermodel.cpp b/core/paintbuffermodel.cpp index 035e3d3568..468717eb4f 100644 --- a/core/paintbuffermodel.cpp +++ b/core/paintbuffermodel.cpp @@ -135,7 +135,7 @@ PaintBuffer PaintBufferModel::buffer() const void PaintBufferModel::setCosts(const QVector &costs) { m_costs = costs; - if (rowCount() > 0) { + if (rowCount() > 0 && !m_costs.isEmpty()) { m_maxCost = *std::max_element(m_costs.constBegin(), m_costs.constEnd()); emit dataChanged(index(0, 2, QModelIndex()), index(rowCount() - 1, 2, QModelIndex())); }