diff options
| author | Yukihiro Matz Matsumoto <[email protected]> | 2013-01-26 00:17:40 +0900 |
|---|---|---|
| committer | Yukihiro Matz Matsumoto <[email protected]> | 2013-01-26 00:17:40 +0900 |
| commit | 47d7cce66dc79235509130bcfc5ca0d32c21337b (patch) | |
| tree | b1d647f6c3cf5f31c14834e8f635cb9dbad0b06a /src | |
| parent | a01343d57eb7fb5f9abfc4bc785d9535443218fd (diff) | |
| download | mruby-47d7cce66dc79235509130bcfc5ca0d32c21337b.tar.gz mruby-47d7cce66dc79235509130bcfc5ca0d32c21337b.zip | |
inspecting anonymous class should not SEGV; close #780
Diffstat (limited to 'src')
| -rw-r--r-- | src/class.c | 7 |
1 files changed, 6 insertions, 1 deletions
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, "#<Class:%p>", c); + path = mrb_str_new_cstr(mrb, buf); + } return mrb_str_ptr(path)->ptr; } |
