contrib/bitset: avoid UB on when copying a bitset

This commit is contained in:
Christian Hergert
2024-11-25 16:26:35 -08:00
parent 4bd113402b
commit 087ce547f2

View File

@ -319,7 +319,9 @@ egg_bitset_copy (const EggBitset *self)
g_return_val_if_fail (self != NULL, NULL);
copy = egg_bitset_new_empty ();
roaring_bitmap_overwrite (&copy->roaring, &self->roaring);
if (!egg_bitset_is_empty (self))
roaring_bitmap_overwrite (&copy->roaring, &self->roaring);
return copy;
}