[anjuta] symbol-db: Consider NULL as valid input for sdb_model_iter_n_children



commit 6b4608b297f15ac0cbe8df5f426a931b1f128f89
Author: Naba Kumar <naba gnome org>
Date:   Thu May 19 17:23:34 2011 +0300

    symbol-db: Consider NULL as valid input for sdb_model_iter_n_children

 plugins/symbol-db/symbol-db-model.c |   25 ++++++++++++++++++-------
 1 files changed, 18 insertions(+), 7 deletions(-)
---
diff --git a/plugins/symbol-db/symbol-db-model.c b/plugins/symbol-db/symbol-db-model.c
index 64cf5bd..3678b28 100644
--- a/plugins/symbol-db/symbol-db-model.c
+++ b/plugins/symbol-db/symbol-db-model.c
@@ -833,15 +833,26 @@ sdb_model_iter_n_children (GtkTreeModel *tree_model,
                            GtkTreeIter *iter)
 {
 	gint offset;
+	SymbolDBModelPriv *priv;
 	SymbolDBModelNode *node, *parent_node;
 	
-	g_return_val_if_fail (sdb_model_iter_is_valid (tree_model, iter),
-	                      FALSE);
-	
-	parent_node = (SymbolDBModelNode*) iter->user_data;
-	offset = GPOINTER_TO_INT (iter->user_data2);
-	
-	node = sdb_model_node_get_child (parent_node, offset);
+	g_return_val_if_fail (SYMBOL_DB_IS_MODEL (tree_model), 0);
+	priv = SYMBOL_DB_MODEL (tree_model)->priv;
+
+	if (iter)
+	{
+		g_return_val_if_fail (sdb_model_iter_is_valid (tree_model, iter), 0);
+	}
+
+	if (iter == NULL)
+		node = priv->root;
+	else
+	{
+		parent_node = (SymbolDBModelNode*) iter->user_data;
+		offset = GPOINTER_TO_INT (iter->user_data2);
+		node = sdb_model_node_get_child (parent_node, offset);
+	}
+
 	if (node == NULL)
 		return 0;
 	if (!node->children_ensured)



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