mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Raise special Exception when exception class is redefined; fix #3493
This commit is contained in:
+8
-2
@@ -330,8 +330,14 @@ mrb_class_get(mrb_state *mrb, const char *name)
|
||||
MRB_API struct RClass *
|
||||
mrb_exc_get(mrb_state *mrb, const char *name)
|
||||
{
|
||||
struct RClass *exc = mrb_class_get_under(mrb, mrb->object_class, name);
|
||||
struct RClass *e = exc;
|
||||
struct RClass *exc, *e;
|
||||
mrb_value c = mrb_const_get(mrb, mrb_obj_value(mrb->object_class),
|
||||
mrb_intern_cstr(mrb, name));
|
||||
|
||||
if (mrb_type(c) != MRB_TT_CLASS) {
|
||||
mrb_raise(mrb, mrb->eException_class, "exception corrupted");
|
||||
}
|
||||
exc = e = mrb_class_ptr(c);
|
||||
|
||||
while (e) {
|
||||
if (e == mrb->eException_class)
|
||||
|
||||
Reference in New Issue
Block a user