[gnome-builder] autotools: check result of g_get_user_special_dir()



commit ad4d665244a1d75ee2ac50cae2046b433e9d2c2b
Author: Jürg Billeter <j bitron ch>
Date:   Sat Mar 26 08:48:38 2016 +0100

    autotools: check result of g_get_user_special_dir()
    
    This fixes the following critical warning:
    
    CRITICAL: g_file_new_for_path: assertion 'path != NULL' failed
    
    https://bugzilla.gnome.org/show_bug.cgi?id=764226

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


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