[gnome-documents] search: be more careful when constructing a GFile



commit 75fd47ba0703f6da1ca87d6bf4318f7395fbb15a
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Sun Nov 11 07:26:43 2018 -0800

    search: be more careful when constructing a GFile
    
    g_get_user_special_dir() may return NULL, which will be a problem
    when building a GFile for that path.
    
    See also https://gitlab.gnome.org/GNOME/gnome-documents/merge_requests/10

 src/search.js | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/src/search.js b/src/search.js
index 9a426e34..f4b3c98f 100644
--- a/src/search.js
+++ b/src/search.js
@@ -369,7 +369,11 @@ const Source = new Lang.Class({
 
                 // also ignore XDG locations if they are present with their full path
                 for (let idx = 0; idx < GLib.UserDirectory.N_DIRECTORIES; idx++) {
-                    let file = Gio.file_new_for_path(GLib.get_user_special_dir(idx));
+                    let path = GLib.get_user_special_dir(idx);
+                    if (!path)
+                        continue;
+
+                    let file = Gio.file_new_for_path(path);
                     if (trackerFile.equal(file))
                         return;
                 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]