mirror of
				https://gitlab.gnome.org/GNOME/glib.git
				synced 2025-11-04 01:58:54 +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:
		@@ -1732,6 +1732,7 @@ node_get_by_pos (GSequenceNode *node,
 | 
			
		||||
        {
 | 
			
		||||
          node = node->left;
 | 
			
		||||
        }
 | 
			
		||||
      g_assert (node != NULL);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  return node;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user