GVariant parser: turn two asserts into soft errors

Parsing wrongly-typed GVariant text format data is a well-defined
operation and it ought to result in a GError.  We do that for most
cases, but 'v' and 'ay' were being treated differently.  Fix those as
well.
This commit is contained in:
Ryan Lortie 2013-04-17 12:08:00 -04:00
parent c70b497859
commit 1d87c6c7f8

View File

@ -1142,7 +1142,9 @@ variant_get_value (AST *ast,
Variant *variant = (Variant *) ast;
GVariant *child;
g_assert (g_variant_type_equal (type, G_VARIANT_TYPE_VARIANT));
if (!g_variant_type_equal (type, G_VARIANT_TYPE_VARIANT))
return ast_type_error (ast, type, error);
child = ast_resolve (variant->value, error);
if (child == NULL)
@ -1656,7 +1658,8 @@ bytestring_get_value (AST *ast,
{
ByteString *string = (ByteString *) ast;
g_assert (g_variant_type_equal (type, G_VARIANT_TYPE_BYTESTRING));
if (!g_variant_type_equal (type, G_VARIANT_TYPE_BYTESTRING))
return ast_type_error (ast, type, error);
return g_variant_new_bytestring (string->string);
}