From 14dd93b655b22ca17cfb041529ae84e91eca4a75 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Tue, 13 Aug 2019 08:08:34 +0200 Subject: Mobile: fix bound check in DiveListModel::data() Indexes go from 0 to count - 1. Thus, the comparison for invalid indexes has to read ">= count", not "> count". Signed-off-by: Berthold Stoeger --- qt-models/divelistmodel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'qt-models') diff --git a/qt-models/divelistmodel.cpp b/qt-models/divelistmodel.cpp index f85e5e521..72ce90049 100644 --- a/qt-models/divelistmodel.cpp +++ b/qt-models/divelistmodel.cpp @@ -238,7 +238,7 @@ int DiveListModel::getDiveIdx(int id) const QVariant DiveListModel::data(const QModelIndex &index, int role) const { - if(index.row() < 0 || index.row() > m_dives.count()) + if(index.row() < 0 || index.row() >= m_dives.count()) return QVariant(); DiveObjectHelper *curr_dive = m_dives[index.row()]; -- cgit v1.2.3-70-g09d2