It is a valid usecase that the model can be 0 when destructing a view.

svn path=/trunk/KDE/kdebase/apps/; revision=1184156
This commit is contained in:
Peter Penz 2010-10-09 10:14:12 +00:00
parent 7e864a72b1
commit af820f077b

View file

@ -197,9 +197,13 @@ KFileItem DolphinViewController::itemForIndex(const QModelIndex& index) const
Q_ASSERT(m_itemView != 0);
QAbstractProxyModel* proxyModel = static_cast<QAbstractProxyModel*>(m_itemView->model());
KDirModel* dirModel = static_cast<KDirModel*>(proxyModel->sourceModel());
const QModelIndex dirIndex = proxyModel->mapToSource(index);
return dirModel->itemForIndex(dirIndex);
if (proxyModel != 0) {
KDirModel* dirModel = static_cast<KDirModel*>(proxyModel->sourceModel());
const QModelIndex dirIndex = proxyModel->mapToSource(index);
return dirModel->itemForIndex(dirIndex);
}
return KFileItem();
}
void DolphinViewController::triggerItem(const QModelIndex& index)