[gnome-builder] autotools: be more defensive against invalid GFile



commit e752c4e30a9c871aaab132a27359b4e33d77211b
Author: Christian Hergert <christian hergert me>
Date:   Wed Apr 13 01:59:16 2016 -0700

    autotools: be more defensive against invalid GFile
    
    Apparently we can get a NULL gfile from the path. Not exactly sure why,
    but lets see if this helps.

 plugins/autotools/ide-autotools-project-miner.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/plugins/autotools/ide-autotools-project-miner.c b/plugins/autotools/ide-autotools-project-miner.c
index 4069635..b3c2aa6 100644
--- a/plugins/autotools/ide-autotools-project-miner.c
+++ b/plugins/autotools/ide-autotools-project-miner.c
@@ -426,18 +426,18 @@ ide_autotools_project_miner_class_init (IdeAutotoolsProjectMinerClass *klass)
 
   for (guint i = 0; i < G_USER_N_DIRECTORIES; i++)
     {
+      g_autoptr(GFile) dir = NULL;
       const gchar *path;
-      GFile *dir;
 
       path = g_get_user_special_dir (i);
-      if (!path)
+      if (path == NULL)
         continue;
 
       dir = g_file_new_for_path (path);
+      if (dir == NULL)
+        continue;
 
-      if (g_file_equal (dir, home))
-        g_clear_object (&dir);
-      else
+      if (!g_file_equal (dir, home))
         g_ptr_array_add (ignored_directories, dir);
     }
 }


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