gobject: Add a missing NULL check for the return from lookup_type_node_I()

This can cause a `NULL` dereference on the next line if there is no
`TypeNode` for `iface_type`, for example if `iface_type ==
G_TYPE_INVALID`.

Unlikely, but possible since this API is public.

Spotted by Coverity.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Coverity CID: #1501602
This commit is contained in:
Philip Withnall
2022-12-21 19:16:10 +00:00
parent 5e378c775a
commit 251bab3e71
2 changed files with 5 additions and 1 deletions

View File

@@ -4161,7 +4161,7 @@ g_type_check_instance_is_a (GTypeInstance *type_instance,
return FALSE;
iface = lookup_type_node_I (iface_type);
if (iface->is_final)
if (iface && iface->is_final)
return type_instance->g_class->g_type == iface_type;
node = lookup_type_node_I (type_instance->g_class->g_type);