grel: Check the number of fields is 2

This is what’s documented as supported (and the only value that is
supported), so might as well check for it early.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
This commit is contained in:
Philip Withnall
2025-04-10 18:34:54 +01:00
parent 03c766879a
commit 29068a5a37

View File

@@ -197,6 +197,8 @@ g_relation_new (gint fields)
GRelation* rel = g_new0 (GRelation, 1);
size_t unsigned_fields;
g_return_val_if_fail (fields == 2, NULL);
unsigned_fields = (size_t) fields;
rel->fields = unsigned_fields;