mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Don't deleteLater a null pointer
When the application launches, the oldModel is null. Signed-off-by: Thiago Macieira <thiago@macieira.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
18e5155ba5
commit
3024b2b83c
1 changed files with 2 additions and 1 deletions
|
@ -26,7 +26,8 @@ void DiveListView::reload()
|
||||||
{
|
{
|
||||||
QSortFilterProxyModel *m = qobject_cast<QSortFilterProxyModel*>(model());
|
QSortFilterProxyModel *m = qobject_cast<QSortFilterProxyModel*>(model());
|
||||||
QAbstractItemModel *oldModel = m->sourceModel();
|
QAbstractItemModel *oldModel = m->sourceModel();
|
||||||
oldModel->deleteLater();
|
if (oldModel)
|
||||||
|
oldModel->deleteLater();
|
||||||
m->setSourceModel(new DiveTripModel(this));
|
m->setSourceModel(new DiveTripModel(this));
|
||||||
sortByColumn(0, Qt::DescendingOrder);
|
sortByColumn(0, Qt::DescendingOrder);
|
||||||
QModelIndex firstDiveOrTrip = m->index(0,0);
|
QModelIndex firstDiveOrTrip = m->index(0,0);
|
||||||
|
|
Loading…
Add table
Reference in a new issue