- index = (unsigned long) g_hash_table_lookup(untagged_variant_declaration->fields_by_tag,
- (gconstpointer) (unsigned long) tag);
- return &g_array_index(untagged_variant_declaration->fields, struct declaration_field, index);
+ found = g_hash_table_lookup_extended(
+ untagged_variant_declaration->fields_by_tag,
+ (gconstpointer) (unsigned long) tag, NULL, &index);
+
+ if (!found) {
+ return NULL;
+ }
+
+ return &g_array_index(untagged_variant_declaration->fields, struct declaration_field, (unsigned long)index);