Skip to content

Commit

Permalink
Avoid crash when m_costs is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
dfaure-kdab committed Apr 4, 2024
1 parent 737c064 commit 08ad63c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/paintbuffermodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ PaintBuffer PaintBufferModel::buffer() const
void PaintBufferModel::setCosts(const QVector<double> &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()));
}
Expand Down

0 comments on commit 08ad63c

Please sign in to comment.