python: check if hashtable is NULL before deallocatio (#44287)n

This commit is contained in:
Benjamin Dauvergne 2020-06-20 08:04:25 +02:00
parent 0289da907f
commit f80b2bb50e
1 changed files with 1 additions and 1 deletions

View File

@ -91,7 +91,7 @@ class Binding:
k_type = key_type(type)
v_type = value_type(type)
if is_cstring(el_type) or (is_cstring(k_type) and is_cstring(v_type)):
print_(' g_hash_table_destroy(%s);' % name, file=fd)
print_(' if (%s) { g_hash_table_destroy(%s); }' % (name, name), file=fd)
else:
raise Exception('Unsupported free value of type GHashTable: %s' % type)
elif is_object(type):