Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions modulemd/modulemd-util.c
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,12 @@ destroy_variant_data (gpointer data)
GVariant *
modulemd_variant_deep_copy (GVariant *variant)
{
// g_variant_store will not accept NULL from 2.84.1
if (variant == NULL)
{
return g_variant_ref_sink (g_variant_new_maybe (G_VARIANT_TYPE_VARIANT, NULL));
}

Comment on lines 362 to +369
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're passeed NULL for input to a copy function, shouldn't we just return NULL instead? There's obviously nothing to actually copy, so creating an empty variant seems odd.

It's also entirely possible that we need to figure out why it's getting passed NULL in the first place. Ticket #623 suggests that interacting with certain repos causes this, so could you figure out how to recreate the problem (ideally in the test suite)?

const GVariantType *data_type = g_variant_get_type (variant);
gsize data_size = g_variant_get_size (variant);
gpointer data = g_malloc0 (data_size);
Expand Down
Loading