mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-24 03:02:10 +01:00
gsequence: Squash a static analysis false positive
scan-build thinks there can be a `NULL` pointer dereference in `while ((i = N_NODES (node->left)) != pos)`, if `node` is `NULL`. `node` cannot be `NULL`, though, assuming the `n_nodes` member of each node in the tree is an accurate count of the number of nodes beneath that point. It controls the tree descent and avoids trying to descend beneath a leaf. A static analyser can’t know this though, so let’s add an assertion to help. Signed-off-by: Philip Withnall <pwithnall@gnome.org> Helps: #1767
This commit is contained in:
parent
ff4c17bc30
commit
c4affcb4f0
@ -1732,6 +1732,7 @@ node_get_by_pos (GSequenceNode *node,
|
|||||||
{
|
{
|
||||||
node = node->left;
|
node = node->left;
|
||||||
}
|
}
|
||||||
|
g_assert (node != NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
return node;
|
return node;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user