From 29741f0ed2328ce3c010a9d51cff39790b9b27ca Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Sat, 24 Jun 2017 12:06:19 -0700 Subject: 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 --- qt-models/diveimportedmodel.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'qt-models') 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; -- cgit v1.2.3-70-g09d2