mirror of
https://invent.kde.org/system/dolphin
synced 2024-09-12 12:54:29 +00:00
fix possible crash if the base URL is empty
svn path=/trunk/KDE/kdebase/apps/; revision=653996
This commit is contained in:
parent
4f6b9c72d3
commit
7cb4232a8c
|
@ -87,9 +87,17 @@ void TreeViewSidebarPage::setUrl(const KUrl& url)
|
|||
|
||||
m_url = url;
|
||||
|
||||
kDebug() << "-------------- Treeview: url = " << url << endl;
|
||||
|
||||
// adjust the root of the tree to the base bookmark
|
||||
KFilePlacesModel *placesModel = DolphinSettings::instance().placesModel();
|
||||
const KUrl baseUrl = placesModel->url(placesModel->closestItem(url));
|
||||
KFilePlacesModel* placesModel = DolphinSettings::instance().placesModel();
|
||||
KUrl baseUrl = placesModel->url(placesModel->closestItem(url));
|
||||
if (!baseUrl.isValid()) {
|
||||
// it's possible that no closest item is available and hence an
|
||||
// empty URL is returned
|
||||
baseUrl = url;
|
||||
}
|
||||
|
||||
if (m_dirLister->url() != baseUrl) {
|
||||
m_dirLister->stop();
|
||||
m_dirLister->openUrl(baseUrl);
|
||||
|
|
Loading…
Reference in a new issue