diff --git a/core/class.c b/core/class.c index 0967330..6d5942a 100644 --- a/core/class.c +++ b/core/class.c @@ -2,6 +2,7 @@ #include "type.h" +#include #include #include #include @@ -18,11 +19,23 @@ void *b_class_get(b_type id) const char *b_class_get_name(const struct _b_class *c) { + if (!c) { + return NULL; + } + + assert(c->c_magic == B_CLASS_MAGIC); + return c->c_type->r_info->t_name; } void *b_class_get_interface(const struct _b_class *c, const union b_type *id) { + if (!c) { + return NULL; + } + + assert(c->c_magic == B_CLASS_MAGIC); + const struct b_type_registration *type_reg = c->c_type; struct b_type_component *comp = b_type_get_component(&type_reg->r_components, id);