linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] test-inspect: handle special case iter==NULL
@ 2017-08-10 21:02 Christopher Li
  0 siblings, 0 replies; only message in thread
From: Christopher Li @ 2017-08-10 21:02 UTC (permalink / raw)
  To: Linux-Sparse; +Cc: Luc Van Oostenryck, Dibyendu Majumdar

GtkTreeView has this special case that iter==NULL means the
root node.

Reported-by: Dibyendu Majumdar <mobile@majumdar.org.uk>
Signed-off-by: Christopher Li <sparse@chrisli.org>
---
 ast-model.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/ast-model.c b/ast-model.c
index 63d2762..cbd82db 100644
--- a/ast-model.c
+++ b/ast-model.c
@@ -401,7 +401,8 @@ static gint
 ast_iter_n_children (GtkTreeModel *tree_model,
                           GtkTreeIter  *iter)
 {
- AstNode  *node = iter->user_data;
+ AstNode  *node = iter ? iter->user_data
+ : AST_NODE(tree_model);

  inspect_child_node(node);
  return node->childnodes->len;
-- 
2.13.3

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2017-08-10 21:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-10 21:02 [PATCH 1/2] test-inspect: handle special case iter==NULL Christopher Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).