linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christopher Li <sparse@chrisli.org>
To: Linux-Sparse <linux-sparse@vger.kernel.org>
Cc: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>,
	Dibyendu Majumdar <mobile@majumdar.org.uk>
Subject: [PATCH 1/2] test-inspect: handle special case iter==NULL
Date: Thu, 10 Aug 2017 17:02:03 -0400	[thread overview]
Message-ID: <CANeU7QnP1afR6ey0Zu1tkoGFGYcCWGaA-Oc1+mbDJdHNSTk1qQ@mail.gmail.com> (raw)

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

                 reply	other threads:[~2017-08-10 21:02 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CANeU7QnP1afR6ey0Zu1tkoGFGYcCWGaA-Oc1+mbDJdHNSTk1qQ@mail.gmail.com \
    --to=sparse@chrisli.org \
    --cc=linux-sparse@vger.kernel.org \
    --cc=luc.vanoostenryck@gmail.com \
    --cc=mobile@majumdar.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).