diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2017-06-24 12:06:19 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2017-06-24 12:06:19 -0700 |
commit | 29741f0ed2328ce3c010a9d51cff39790b9b27ca (patch) | |
tree | ca1bb885aa1b26d0d58a59fb1b61e9ea160926be /qt-models | |
parent | 49a368539ab56f9ca32d39b98ac5b9573b92a705 (diff) | |
download | subsurface-29741f0ed2328ce3c010a9d51cff39790b9b27ca.tar.gz |
Avoid Q_ASSERT with debug build of Qt
I don't know why we are setting lastIndex to -1. That seems odd.
But for now this workaround will have to do.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-models')
-rw-r--r-- | qt-models/diveimportedmodel.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/qt-models/diveimportedmodel.cpp b/qt-models/diveimportedmodel.cpp index b57660362..799dd6ce6 100644 --- a/qt-models/diveimportedmodel.cpp +++ b/qt-models/diveimportedmodel.cpp @@ -124,6 +124,13 @@ Qt::ItemFlags DiveImportedModel::flags(const QModelIndex &index) const void DiveImportedModel::clearTable() { + if (lastIndex < firstIndex) { + // just to be sure it's the right numbers + // but don't call RemoveRows or Qt in debug mode with trigger an ASSERT + lastIndex = -1; + firstIndex = 0; + return; + } beginRemoveRows(QModelIndex(), 0, lastIndex - firstIndex); lastIndex = -1; firstIndex = 0; |