From 02e768a61beda2730efff1e84f5e5b7341418acf Mon Sep 17 00:00:00 2001 From: Stefan Fuchs Date: Fri, 21 Apr 2017 19:46:13 +0200 Subject: After DC import don't do RemoveRows if there is nothing to remove This fixes an issue where beginRemoveRows is called with argument -1 in DiveImportedModel::setImportedDivesIndexes. Signed-off-by: Stefan Fuchs --- desktop-widgets/downloadfromdivecomputer.cpp | 6 ++++-- 1 file 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; -- cgit v1.2.3-70-g09d2