mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
Fix crasher
m_dives can be empty, so make sure we don't push an invalid QModelIndex into the mode. Signed-off-by: Sebastian Kügler <sebas@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
7d2a7da079
commit
9ef475844d
1 changed files with 5 additions and 3 deletions
|
@ -17,9 +17,11 @@ void DiveListModel::addDive(dive *d)
|
|||
|
||||
void DiveListModel::clear()
|
||||
{
|
||||
beginRemoveRows(QModelIndex(), 0, m_dives.count() - 1);
|
||||
m_dives.clear();
|
||||
endRemoveRows();
|
||||
if (m_dives.count()) {
|
||||
beginRemoveRows(QModelIndex(), 0, m_dives.count() - 1);
|
||||
m_dives.clear();
|
||||
endRemoveRows();
|
||||
}
|
||||
}
|
||||
|
||||
int DiveListModel::rowCount(const QModelIndex &) const
|
||||
|
|
Loading…
Reference in a new issue