mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +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()
|
void DiveListModel::clear()
|
||||||
{
|
{
|
||||||
beginRemoveRows(QModelIndex(), 0, m_dives.count() - 1);
|
if (m_dives.count()) {
|
||||||
m_dives.clear();
|
beginRemoveRows(QModelIndex(), 0, m_dives.count() - 1);
|
||||||
endRemoveRows();
|
m_dives.clear();
|
||||||
|
endRemoveRows();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int DiveListModel::rowCount(const QModelIndex &) const
|
int DiveListModel::rowCount(const QModelIndex &) const
|
||||||
|
|
Loading…
Add table
Reference in a new issue