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:
Thiago Macieira 2013-05-16 15:09:45 -06:00 committed by Dirk Hohndel
parent 18e5155ba5
commit 3024b2b83c

View file

@ -26,7 +26,8 @@ void DiveListView::reload()
{
QSortFilterProxyModel *m = qobject_cast<QSortFilterProxyModel*>(model());
QAbstractItemModel *oldModel = m->sourceModel();
oldModel->deleteLater();
if (oldModel)
oldModel->deleteLater();
m->setSourceModel(new DiveTripModel(this));
sortByColumn(0, Qt::DescendingOrder);
QModelIndex firstDiveOrTrip = m->index(0,0);