diff --git a/gobject/gtype.c b/gobject/gtype.c index 9e60a1e28..f766ffdb9 100644 --- a/gobject/gtype.c +++ b/gobject/gtype.c @@ -3972,9 +3972,11 @@ gboolean g_type_check_instance_is_fundamentally_a (GTypeInstance *type_instance, GType fundamental_type) { + TypeNode *node; if (!type_instance || !type_instance->g_class) return FALSE; - return NODE_FUNDAMENTAL_TYPE(lookup_type_node_I (type_instance->g_class->g_type)) == fundamental_type; + node = lookup_type_node_I (type_instance->g_class->g_type); + return node && (NODE_FUNDAMENTAL_TYPE(node) == fundamental_type); } gboolean