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 <pwithnall@gnome.org>

Helps: #1767
This commit is contained in:
Philip Withnall 2024-04-12 15:52:31 +01:00
parent ad0532f2bf
commit 3c6c60611f
No known key found for this signature in database
GPG Key ID: DCDF5885B1F3ED73

View File

@ -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));