gvariant: Add an assertion to clarify some tuple logic

This should quell a scan-build error about dereferencing `member_info`
when it’s `NULL` at the end of the function, due to having zero
iterations of the `for` loop.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
This commit is contained in:
Philip Withnall 2022-11-18 17:00:42 +00:00
parent 146a0a001d
commit e5771df643

View File

@ -983,6 +983,10 @@ gvs_tuple_needed_size (GVariantTypeInfo *type_info,
offset = 0;
/* We must go through at least one iteration below. If the tuple had no
* children, it would have a fixed size. */
g_assert (n_children > 0);
for (i = 0; i < n_children; i++)
{
guint alignment;