From 47d7cce66dc79235509130bcfc5ca0d32c21337b Mon Sep 17 00:00:00 2001 From: Yukihiro Matz Matsumoto Date: Sat, 26 Jan 2013 00:17:40 +0900 Subject: inspecting anonymous class should not SEGV; close #780 --- src/class.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/class.c') diff --git a/src/class.c b/src/class.c index b24dd8a08..530fc5ce4 100644 --- a/src/class.c +++ b/src/class.c @@ -1211,7 +1211,12 @@ const char* mrb_class_name(mrb_state *mrb, struct RClass* 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, "#", c); + path = mrb_str_new_cstr(mrb, buf); + } return mrb_str_ptr(path)->ptr; } -- cgit v1.2.3