]> cloud.milkyroute.net Git - dolphin.git/commitdiff
It is a valid usecase that the model can be 0 when destructing a view.
authorPeter Penz <peter.penz19@gmail.com>
Sat, 9 Oct 2010 10:14:12 +0000 (10:14 +0000)
committerPeter Penz <peter.penz19@gmail.com>
Sat, 9 Oct 2010 10:14:12 +0000 (10:14 +0000)
svn path=/trunk/KDE/kdebase/apps/; revision=1184156

src/views/dolphinviewcontroller.cpp

index 6ef32f07fc3b86782e816003052495e5d717e78e..f82b6755a5d7aea1ceee607306d46b4a337aa7bf 100644 (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)