summaryrefslogtreecommitdiffstats
path: root/qt-ui/diveplanner.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'qt-ui/diveplanner.cpp')
-rw-r--r--qt-ui/diveplanner.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp
index c5ca7f74c..dedbd617d 100644
--- a/qt-ui/diveplanner.cpp
+++ b/qt-ui/diveplanner.cpp
@@ -1396,9 +1396,11 @@ void DivePlannerPointsModel::clear()
memset(stagingDive->cylinder, 0, MAX_CYLINDERS * sizeof(cylinder_t));
}
CylindersModel::instance()->setDive(stagingDive);
- beginRemoveRows(QModelIndex(), 0, rowCount()-1);
- divepoints.clear();
- endRemoveRows();
+ if (rowCount() > 0) {
+ beginRemoveRows(QModelIndex(), 0, rowCount() - 1);
+ divepoints.clear();
+ endRemoveRows();
+ }
CylindersModel::instance()->clear();
}