Skip to content
This repository has been archived by the owner on Nov 17, 2020. It is now read-only.

Commit

Permalink
g_variant_get_child_value: Add a precondition on length
Browse files Browse the repository at this point in the history
Ensure callers get a warning if they pass a bad length.

Split into a separate commit and changed to order index before
n_children by Colin Walters <walters@verbum.org>
  • Loading branch information
gcampax authored and Matthias Clasen committed Jun 5, 2011
1 parent 56c4e19 commit a62eb42
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions glib/gvariant-core.c
Expand Up @@ -848,6 +848,8 @@ GVariant *
g_variant_get_child_value (GVariant *value,
gsize index_)
{
g_return_val_if_fail (index_ < g_variant_n_children (value), NULL);

if (~g_atomic_int_get (&value->state) & STATE_SERIALISED)
{
g_variant_lock (value);
Expand Down

0 comments on commit a62eb42

Please sign in to comment.