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>
This commit is contained in:
Dirk Hohndel 2017-06-24 12:06:19 -07:00
parent 49a368539a
commit 29741f0ed2

View file

@ -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;