summaryrefslogtreecommitdiffstats
path: root/desktop-widgets
diff options
context:
space:
mode:
Diffstat (limited to 'desktop-widgets')
-rw-r--r--desktop-widgets/downloadfromdivecomputer.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/desktop-widgets/downloadfromdivecomputer.cpp b/desktop-widgets/downloadfromdivecomputer.cpp
index fe41c2070..a070c855d 100644
--- a/desktop-widgets/downloadfromdivecomputer.cpp
+++ b/desktop-widgets/downloadfromdivecomputer.cpp
@@ -733,8 +733,10 @@ void DiveImportedModel::clearTable()
void DiveImportedModel::setImportedDivesIndexes(int first, int last)
{
Q_ASSERT(last >= first);
- beginRemoveRows(QModelIndex(), 0, lastIndex - firstIndex);
- endRemoveRows();
+ if (lastIndex >= firstIndex) {
+ beginRemoveRows(QModelIndex(), 0, lastIndex - firstIndex);
+ endRemoveRows();
+ }
beginInsertRows(QModelIndex(), 0, last - first);
lastIndex = last;
firstIndex = first;