diff --git a/src/widgets/kdirmodel.cpp b/src/widgets/kdirmodel.cpp --- a/src/widgets/kdirmodel.cpp +++ b/src/widgets/kdirmodel.cpp @@ -247,6 +247,7 @@ KDirModelNode *KDirModelPrivate::nodeForUrl(const QUrl &_url) const // O(1), well, O(length of url as a string) { + QUrl url = cleanupUrl(_url); if (url == urlForNode(m_rootNode)) { return m_rootNode; @@ -341,7 +342,7 @@ // node -> index. If rowNumber is set (or node is root): O(1). Otherwise: O(n). QModelIndex KDirModelPrivate::indexForNode(KDirModelNode *node, int rowNumber) const { - if (node == m_rootNode) { + if (!node || node == m_rootNode) { return QModelIndex(); }