summaryrefslogtreecommitdiffstats
path: root/qt-models
diff options
context:
space:
mode:
Diffstat (limited to 'qt-models')
-rw-r--r--qt-models/divelistmodel.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/qt-models/divelistmodel.cpp b/qt-models/divelistmodel.cpp
index 18f270c15..86c977fc9 100644
--- a/qt-models/divelistmodel.cpp
+++ b/qt-models/divelistmodel.cpp
@@ -17,9 +17,11 @@ void DiveListModel::addDive(dive *d)
void DiveListModel::clear()
{
- beginRemoveRows(QModelIndex(), 0, m_dives.count() - 1);
- m_dives.clear();
- endRemoveRows();
+ if (m_dives.count()) {
+ beginRemoveRows(QModelIndex(), 0, m_dives.count() - 1);
+ m_dives.clear();
+ endRemoveRows();
+ }
}
int DiveListModel::rowCount(const QModelIndex &) const