[gnome-builder] project-tree: handle NULL ancestors when adding files



commit f0562c2f3974b7461af0aedc53d99ee81d45a720
Author: Christian Hergert <chergert redhat com>
Date:   Thu Mar 14 11:18:16 2019 -0700

    project-tree: handle NULL ancestors when adding files
    
    This fixes a warning where we fail to locate the parent
    directory because we have not yet expanded to it.

 src/plugins/project-tree/gbp-project-tree-addin.c | 4 ++++
 1 file changed, 4 insertions(+)
---
diff --git a/src/plugins/project-tree/gbp-project-tree-addin.c 
b/src/plugins/project-tree/gbp-project-tree-addin.c
index 4e2018302..73549ba0a 100644
--- a/src/plugins/project-tree/gbp-project-tree-addin.c
+++ b/src/plugins/project-tree/gbp-project-tree-addin.c
@@ -456,6 +456,10 @@ gbp_project_tree_addin_add_file (GbpProjectTreeAddin *self,
       directory = g_file_get_parent (item);
       parent = find_file_node (self->tree, directory);
 
+      /* Nothing to do, no ancestor to attach child */
+      if (parent == NULL)
+        break;
+
       info = g_file_query_info (item,
                                 IDE_PROJECT_FILE_ATTRIBUTES,
                                 G_FILE_QUERY_INFO_NONE,


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