summaryrefslogtreecommitdiffstats
path: root/qt-ui/downloadfromdivecomputer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'qt-ui/downloadfromdivecomputer.cpp')
-rw-r--r--qt-ui/downloadfromdivecomputer.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/qt-ui/downloadfromdivecomputer.cpp b/qt-ui/downloadfromdivecomputer.cpp
index 44ea3881f..e78270ab0 100644
--- a/qt-ui/downloadfromdivecomputer.cpp
+++ b/qt-ui/downloadfromdivecomputer.cpp
@@ -629,14 +629,15 @@ Qt::ItemFlags DiveImportedModel::flags(const QModelIndex &index) const
void DiveImportedModel::setImportedDivesIndexes(int first, int last)
{
+ Q_ASSERT(last >= first);
beginRemoveRows(QModelIndex(), 0, lastIndex - firstIndex);
endRemoveRows();
beginInsertRows(QModelIndex(), 0, last - first);
lastIndex = last;
firstIndex = first;
delete[] checkStates;
- checkStates = new bool[last - first];
- memset(checkStates, true, last - first);
+ checkStates = new bool[last - first + 1];
+ memset(checkStates, true, last - first + 1);
endInsertRows();
}