Merge branch 'coverity-iface-null' into 'main'

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

See merge request GNOME/glib!3162
This commit is contained in:
Emmanuele Bassi 2023-01-05 18:57:21 +00:00
commit 892deb8f93
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);

View File

@ -130,6 +130,8 @@ test_type_flags_final_instance_check (void)
TEST_TYPE_DEPRECATED));
g_assert_true (g_type_check_instance_is_a ((GTypeInstance *) final,
G_TYPE_OBJECT));
g_assert_false (g_type_check_instance_is_a ((GTypeInstance *) final,
G_TYPE_INVALID));
g_clear_object (&final);
}
@ -184,6 +186,8 @@ test_type_flags_deprecated (void)
G_TYPE_OBJECT));
g_assert_false (g_type_check_instance_is_a ((GTypeInstance *) deprecated_object,
TEST_TYPE_FINAL));
g_assert_false (g_type_check_instance_is_a ((GTypeInstance *) deprecated_object,
G_TYPE_INVALID));
g_test_assert_expected_messages ();