diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2019-08-13 08:08:34 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2019-08-13 07:27:48 -0700 |
commit | 14dd93b655b22ca17cfb041529ae84e91eca4a75 (patch) | |
tree | ebcd5ce4f4a35565ff05a39d7a57dc519e79340a /qt-models | |
parent | 62cbfc332542b09dc4d7d82f7b1ee61bdde6d800 (diff) | |
download | subsurface-14dd93b655b22ca17cfb041529ae84e91eca4a75.tar.gz |
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 <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'qt-models')
-rw-r--r-- | qt-models/divelistmodel.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
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()]; |