Skip to content

Commit 845b8c5

Browse files
committed
return g_variant_new_maybe for NULL variants
From glib 2.84.1, `g_variant_store` will not accept `NULL` values instead failing an assertion and throwing a critical error. In the case where `variant` == `NULL`, instead we can wrap and return a `g_variant_new_maybe` with a child of `NULL` to achieve the same effective result. Closes: #623 Signed-off-by: Matt Jolly <[email protected]>
1 parent c6ffc06 commit 845b8c5

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

modulemd/modulemd-util.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,12 @@ destroy_variant_data (gpointer data)
361361
GVariant *
362362
modulemd_variant_deep_copy (GVariant *variant)
363363
{
364+
// g_variant_store will not accept NULL from 2.84.1
365+
if (variant == NULL)
366+
{
367+
return g_variant_ref_sink (g_variant_new_maybe (G_VARIANT_TYPE_VARIANT, NULL));
368+
}
369+
364370
const GVariantType *data_type = g_variant_get_type (variant);
365371
gsize data_size = g_variant_get_size (variant);
366372
gpointer data = g_malloc0 (data_size);

0 commit comments

Comments
 (0)