diff --git a/glib/gvariant-serialiser.c b/glib/gvariant-serialiser.c index 832a8fdc2..7b13381b6 100644 --- a/glib/gvariant-serialiser.c +++ b/glib/gvariant-serialiser.c @@ -1587,6 +1587,9 @@ g_variant_serialised_byteswap (GVariantSerialised serialised) gboolean g_variant_serialised_is_normal (GVariantSerialised serialised) { + if (serialised.depth >= G_VARIANT_MAX_RECURSION_DEPTH) + return FALSE; + DISPATCH_CASES (serialised.type_info, return gvs_/**/,/**/_is_normal (serialised); @@ -1595,8 +1598,6 @@ g_variant_serialised_is_normal (GVariantSerialised serialised) if (serialised.data == NULL) return FALSE; - if (serialised.depth >= G_VARIANT_MAX_RECURSION_DEPTH) - return FALSE; /* some hard-coded terminal cases */ switch (g_variant_type_info_get_type_char (serialised.type_info))