]> cloud.milkyroute.net Git - dolphin.git/commitdiff
prevent a QFileInfo warning
authorRené Bertin <rjvbertin@gmail.com>
Mon, 27 Apr 2020 08:32:34 +0000 (10:32 +0200)
committerRené Bertin <rjvbertin@gmail.com>
Mon, 27 Apr 2020 08:32:34 +0000 (10:32 +0200)
DolphinSearchBox::init() can generate a terminal warning depending on
the user's search history:

QFileInfo::absolutePath: Constructed with empty filename

The warning can seem to appear randomly if you don't use the search
feature often, because of its dependency on previous search activity.

Prevent this warning by adding a simple check if the current
m_searchPath is valid or not. This check has no effect on the value
returned by DolphinSearchBox::isIndexingEnabled() and is in line with
the fact that m_searchPath == QUrl() indicates that no search path has
been set.

Differential Revision: https://phabricator.kde.org/D29194

src/search/dolphinsearchbox.cpp

index 22941104cc95aff67dc8dda92efcdca5b735e9ba..52a495270615bebe6aa39f6079a289badcd8e3cd 100644 (file)
@@ -544,7 +544,7 @@ bool DolphinSearchBox::isIndexingEnabled() const
 {
 #ifdef HAVE_BALOO
     const Baloo::IndexerConfig searchInfo;
-    return searchInfo.fileIndexingEnabled() && searchInfo.shouldBeIndexed(searchPath().toLocalFile());
+    return searchInfo.fileIndexingEnabled() && !searchPath().isEmpty() && searchInfo.shouldBeIndexed(searchPath().toLocalFile());
 #else
     return false;
 #endif