inspecting anonymous class should not SEGV; close #780

parent a01343d5
...@@ -1211,7 +1211,12 @@ const char* ...@@ -1211,7 +1211,12 @@ const char*
mrb_class_name(mrb_state *mrb, struct RClass* c) mrb_class_name(mrb_state *mrb, struct RClass* c)
{ {
mrb_value path = mrb_class_path(mrb, c); mrb_value path = mrb_class_path(mrb, c);
if (mrb_nil_p(path)) return 0; if (mrb_nil_p(path)) {
char buf[32];
snprintf(buf, 32, "#<Class:%p>", c);
path = mrb_str_new_cstr(mrb, buf);
}
return mrb_str_ptr(path)->ptr; return mrb_str_ptr(path)->ptr;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment