diff options
| author | Peter Penz <[email protected]> | 2010-10-15 11:44:43 +0000 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2010-10-15 11:44:43 +0000 |
| commit | a85590ad078496f0ef9d86af91e7500f767e0988 (patch) | |
| tree | 5a8d9d104035bc90c8af9da514adb660ace6f5c7 /src/views/dolphinviewcontroller.cpp | |
| parent | 363e5b69dda38a963f8fc4b5145eee4732bc31d9 (diff) | |
It is a valid use-case that m_itemView is 0.
BUG: 254240
svn path=/trunk/KDE/kdebase/apps/; revision=1186206
Diffstat (limited to 'src/views/dolphinviewcontroller.cpp')
| -rw-r--r-- | src/views/dolphinviewcontroller.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/views/dolphinviewcontroller.cpp b/src/views/dolphinviewcontroller.cpp index f82b6755a..6e2570007 100644 --- a/src/views/dolphinviewcontroller.cpp +++ b/src/views/dolphinviewcontroller.cpp @@ -128,7 +128,9 @@ QList<QAction*> DolphinViewController::versionControlActions(const KFileItemList void DolphinViewController::handleKeyPressEvent(QKeyEvent* event) { - Q_ASSERT(m_itemView != 0); + if (m_itemView == 0) { + return; + } const QItemSelectionModel* selModel = m_itemView->selectionModel(); const QModelIndex currentIndex = selModel->currentIndex(); @@ -194,13 +196,13 @@ void DolphinViewController::emitItemTriggered(const KFileItem& item) KFileItem DolphinViewController::itemForIndex(const QModelIndex& index) const { - Q_ASSERT(m_itemView != 0); - - QAbstractProxyModel* proxyModel = static_cast<QAbstractProxyModel*>(m_itemView->model()); - if (proxyModel != 0) { - KDirModel* dirModel = static_cast<KDirModel*>(proxyModel->sourceModel()); - const QModelIndex dirIndex = proxyModel->mapToSource(index); - return dirModel->itemForIndex(dirIndex); + if (m_itemView != 0) { + QAbstractProxyModel* proxyModel = static_cast<QAbstractProxyModel*>(m_itemView->model()); + if (proxyModel != 0) { + KDirModel* dirModel = static_cast<KDirModel*>(proxyModel->sourceModel()); + const QModelIndex dirIndex = proxyModel->mapToSource(index); + return dirModel->itemForIndex(dirIndex); + } } return KFileItem(); @@ -212,7 +214,7 @@ void DolphinViewController::triggerItem(const QModelIndex& index) const KFileItem item = itemForIndex(index); if (index.isValid() && (index.column() == KDirModel::Name)) { emit itemTriggered(item); - } else { + } else if (m_itemView != 0) { m_itemView->clearSelection(); emit itemEntered(KFileItem()); } |
