┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/views/dolphinviewcontroller.cpp
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2010-10-09 10:14:12 +0000
committerPeter Penz <[email protected]>2010-10-09 10:14:12 +0000
commitaf820f077b0d311ad99d3736015d62a081dea92d (patch)
treebab27dc8ffe8bac35d82daeb447912a4de73d7b5 /src/views/dolphinviewcontroller.cpp
parent7e864a72b19b72be58d1924264b72bb2f203dda9 (diff)
It is a valid usecase that the model can be 0 when destructing a view.
svn path=/trunk/KDE/kdebase/apps/; revision=1184156
Diffstat (limited to 'src/views/dolphinviewcontroller.cpp')
-rw-r--r--src/views/dolphinviewcontroller.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/views/dolphinviewcontroller.cpp b/src/views/dolphinviewcontroller.cpp
index 6ef32f07f..f82b6755a 100644
--- a/src/views/dolphinviewcontroller.cpp
+++ b/src/views/dolphinviewcontroller.cpp
@@ -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)