From 3c6c60611f4279d2ab51db4d4e62c13f3ad425cb Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Fri, 12 Apr 2024 15:52:31 +0100 Subject: [PATCH] girnode: Simplify NULL node handling All of the indications in the surrounding code are that `node` should never be `NULL`, but the error handling for it did actually allow it to be `NULL` iff its `parent` was also `NULL`. That made scan-build (kind of legitimately) warn about `NULL` pointer dereferences of `node`. Avoid that by unambiguously using an assertion to prevent `NULL` nodes. Signed-off-by: Philip Withnall Helps: #1767 --- girepository/girnode.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/girepository/girnode.c b/girepository/girnode.c index 3a0983014..efc022d72 100644 --- a/girepository/girnode.c +++ b/girepository/girnode.c @@ -594,8 +594,7 @@ gi_ir_node_get_full_size_internal (GIIrNode *parent, GList *l; size_t size, n; - if (node == NULL && parent != NULL) - g_error ("Caught NULL node, parent=%s", parent->name); + g_assert (node != NULL); g_debug ("node %p type '%s'", node, gi_ir_node_type_to_string (node->type));