mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Dive d/l selection UI: the indices are inclusive, allocate enough space
The array we allocated was one entry too small. On the flip side, let's just make sure we cannot call this with a negative range. That would be bad, too. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
cd2cee4974
commit
15fb6158bc
1 changed files with 3 additions and 2 deletions
|
@ -629,14 +629,15 @@ Qt::ItemFlags DiveImportedModel::flags(const QModelIndex &index) const
|
|||
|
||||
void DiveImportedModel::setImportedDivesIndexes(int first, int last)
|
||||
{
|
||||
Q_ASSERT(last >= first);
|
||||
beginRemoveRows(QModelIndex(), 0, lastIndex - firstIndex);
|
||||
endRemoveRows();
|
||||
beginInsertRows(QModelIndex(), 0, last - first);
|
||||
lastIndex = last;
|
||||
firstIndex = first;
|
||||
delete[] checkStates;
|
||||
checkStates = new bool[last - first];
|
||||
memset(checkStates, true, last - first);
|
||||
checkStates = new bool[last - first + 1];
|
||||
memset(checkStates, true, last - first + 1);
|
||||
endInsertRows();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue