summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--qt-models/cylindermodel.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/qt-models/cylindermodel.cpp b/qt-models/cylindermodel.cpp
index dd9ac5e69..2ed81ab72 100644
--- a/qt-models/cylindermodel.cpp
+++ b/qt-models/cylindermodel.cpp
@@ -134,6 +134,11 @@ QVariant CylindersModel::data(const QModelIndex &index, int role) const
if (!index.isValid() || index.row() >= rows)
return QVariant();
+ if (index.row() >= displayed_dive.cylinders.nr) {
+ qWarning("CylindersModel and displayed_dive are out of sync!");
+ return QVariant();
+ }
+
const cylinder_t *cyl = get_cylinder(&displayed_dive, index.row());
switch (role) {