diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2017-07-09 16:04:31 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2017-07-09 16:04:31 -0700 |
commit | f67b3a985274438153ff973ebe56128e353ff81f (patch) | |
tree | 8cb9b7f82f4c6e6e1135eb3827136a8f78c07368 /qt-models | |
parent | fd96daca6a170bfd2ecac45b403c93c63b8473d2 (diff) | |
download | subsurface-f67b3a985274438153ff973ebe56128e353ff81f.tar.gz |
DiveImportedModel: be consistent with last = -1
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-models')
-rw-r--r-- | qt-models/diveimportedmodel.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/qt-models/diveimportedmodel.cpp b/qt-models/diveimportedmodel.cpp index 66be4b5cf..e9e0c45d8 100644 --- a/qt-models/diveimportedmodel.cpp +++ b/qt-models/diveimportedmodel.cpp @@ -139,26 +139,24 @@ void DiveImportedModel::clearTable() void DiveImportedModel::setImportedDivesIndexes(int first, int last) { - Q_ASSERT(last >= first); if (lastIndex >= firstIndex) { beginRemoveRows(QModelIndex(), 0, lastIndex - firstIndex); endRemoveRows(); } - beginInsertRows(QModelIndex(), 0, last - first); + if (last >= first) + beginInsertRows(QModelIndex(), 0, last - first); lastIndex = last; firstIndex = first; delete[] checkStates; checkStates = new bool[last - first + 1]; memset(checkStates, true, last - first + 1); - endInsertRows(); + if (last >= first) + endInsertRows(); } void DiveImportedModel::repopulate() { - if (diveTable->nr) - setImportedDivesIndexes(0, diveTable->nr-1); - else - setImportedDivesIndexes(0, 0); + setImportedDivesIndexes(0, diveTable->nr-1); } void DiveImportedModel::recordDives() |