diff options
author | Stefan Fuchs <sfuchs@gmx.de> | 2017-04-21 19:46:13 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2017-04-21 11:26:49 -0700 |
commit | 02e768a61beda2730efff1e84f5e5b7341418acf (patch) | |
tree | d55b240f33dbdf5bbd556d8b454570a6db94ec6d /desktop-widgets | |
parent | 441cfb3f056d3a57ca27b67f223129f348fb78fe (diff) | |
download | subsurface-02e768a61beda2730efff1e84f5e5b7341418acf.tar.gz |
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 <sfuchs@gmx.de>
Diffstat (limited to 'desktop-widgets')
-rw-r--r-- | desktop-widgets/downloadfromdivecomputer.cpp | 6 |
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; |