Skip to content

Commit c752602

Browse files
committed
Fixrb_obj_classname to return NULL if the class has no name.
1 parent 750e917 commit c752602

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/main/c/cext/ruby.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,12 @@ void rb_obj_call_init(VALUE object, int argc, const VALUE *argv) {
475475
}
476476

477477
const char *rb_obj_classname(VALUE object) {
478-
return RSTRING_PTR(RUBY_CEXT_INVOKE("rb_obj_classname", object));
478+
VALUE str = RUBY_CEXT_INVOKE("rb_obj_classname", object);
479+
if (str != Qnil) {
480+
return RSTRING_PTR(str);
481+
} else {
482+
return NULL;
483+
}
479484
}
480485

481486
VALUE rb_obj_id(VALUE object) {

0 commit comments

Comments
 (0)