mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-14 08:16:24 +01:00
g_variant_get_child_value: Add a precondition on length
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>
This commit is contained in:
parent
e61fa51fd5
commit
39ba9c8e49
@ -848,6 +848,8 @@ GVariant *
|
|||||||
g_variant_get_child_value (GVariant *value,
|
g_variant_get_child_value (GVariant *value,
|
||||||
gsize index_)
|
gsize index_)
|
||||||
{
|
{
|
||||||
|
g_return_val_if_fail (index_ < g_variant_n_children (value), NULL);
|
||||||
|
|
||||||
if (~g_atomic_int_get (&value->state) & STATE_SERIALISED)
|
if (~g_atomic_int_get (&value->state) & STATE_SERIALISED)
|
||||||
{
|
{
|
||||||
g_variant_lock (value);
|
g_variant_lock (value);
|
||||||
|
Loading…
Reference in New Issue
Block a user