[gnome-builder] project-tree: check node before dereferencing it



commit 367f0d46e0f2c77756bde63d30f62c0a9d14f6d2
Author: Christian Hergert <christian hergert me>
Date:   Sat Oct 3 16:17:42 2015 -0700

    project-tree: check node before dereferencing it

 src/project-tree/gb-project-tree-actions.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/src/project-tree/gb-project-tree-actions.c b/src/project-tree/gb-project-tree-actions.c
index 5ee87d6..7eddb34 100644
--- a/src/project-tree/gb-project-tree-actions.c
+++ b/src/project-tree/gb-project-tree-actions.c
@@ -821,11 +821,16 @@ gb_project_tree_actions_move_to_trash (GSimpleAction *action,
 static gboolean
 is_files_node (GbTreeNode *node)
 {
-  GObject *item = gb_tree_node_get_item (node);
-  GbTreeNode *parent = gb_tree_node_get_parent (node);
-  GObject *parent_item = gb_tree_node_get_item (parent);
+  if (node != NULL)
+    {
+      GObject *item = gb_tree_node_get_item (node);
+      GbTreeNode *parent = gb_tree_node_get_parent (node);
+      GObject *parent_item = gb_tree_node_get_item (parent);
 
-  return (GB_IS_PROJECT_FILE (item) && !GB_IS_PROJECT_FILE (parent_item));
+      return (GB_IS_PROJECT_FILE (item) && !GB_IS_PROJECT_FILE (parent_item));
+    }
+
+  return FALSE;
 }
 
 static GActionEntry GbProjectTreeActions[] = {


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