]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/views/dolphinviewcontroller.cpp
The &-shortcut from another action is not set until the action has been shown at...
[dolphin.git] / 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)