Changeset f67b3a9 in subsurface


Ignore:
Timestamp:
Jul 9, 2017, 4:04:31 PM (2 months ago)
Author:
Dirk Hohndel <dirk@…>
Branches:
master
Children:
8e0895e4
Parents:
fd96dac
Message:

DiveImportedModel?: be consistent with last = -1

Signed-off-by: Dirk Hohndel <dirk@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • qt-models/diveimportedmodel.cpp

    rf4f42a0 rf67b3a9  
    140140void DiveImportedModel::setImportedDivesIndexes(int first, int last)
    141141{
    142         Q_ASSERT(last >= first);
    143142        if (lastIndex >= firstIndex) {
    144143                beginRemoveRows(QModelIndex(), 0, lastIndex - firstIndex);
    145144                endRemoveRows();
    146145        }
    147         beginInsertRows(QModelIndex(), 0, last - first);
     146        if (last >= first)
     147                beginInsertRows(QModelIndex(), 0, last - first);
    148148        lastIndex = last;
    149149        firstIndex = first;
     
    151151        checkStates = new bool[last - first + 1];
    152152        memset(checkStates, true, last - first + 1);
    153         endInsertRows();
     153        if (last >= first)
     154                endInsertRows();
    154155}
    155156
    156157void DiveImportedModel::repopulate()
    157158{
    158         if (diveTable->nr)
    159                 setImportedDivesIndexes(0, diveTable->nr-1);
    160         else
    161                 setImportedDivesIndexes(0, 0);
     159        setImportedDivesIndexes(0, diveTable->nr-1);
    162160}
    163161
Note: See TracChangeset for help on using the changeset viewer.