mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
Planner: fix potential assert in clear()
If rowCount() is 0 we get an assert: ASSERT: "last >= first" in file kernel/qabstractitemmodel.cpp... To solve that we wrap the beginRemoveRows() call in a bnrach: if (rowCount() > 0) { ... Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
26a1904cf8
commit
cf9748278f
1 changed files with 5 additions and 3 deletions
|
@ -1396,9 +1396,11 @@ void DivePlannerPointsModel::clear()
|
|||
memset(stagingDive->cylinder, 0, MAX_CYLINDERS * sizeof(cylinder_t));
|
||||
}
|
||||
CylindersModel::instance()->setDive(stagingDive);
|
||||
beginRemoveRows(QModelIndex(), 0, rowCount()-1);
|
||||
divepoints.clear();
|
||||
endRemoveRows();
|
||||
if (rowCount() > 0) {
|
||||
beginRemoveRows(QModelIndex(), 0, rowCount() - 1);
|
||||
divepoints.clear();
|
||||
endRemoveRows();
|
||||
}
|
||||
CylindersModel::instance()->clear();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue