supeclass type check prohibits class definition without superclass specified

This commit is contained in:
Yukihiro Matsumoto
2012-04-26 06:07:41 +09:00
parent e26bf08e39
commit c6f5f637e2
+4 -2
View File
@@ -213,8 +213,10 @@ mrb_vm_define_class(mrb_state *mrb, mrb_value outer, mrb_value super, mrb_sym id
if (!c) {
struct RClass *s = 0;
mrb_check_type(mrb, super, MRB_TT_CLASS);
if (!mrb_nil_p(super)) s = mrb_class_ptr(super);
if (!mrb_nil_p(super)) {
mrb_check_type(mrb, super, MRB_TT_CLASS);
s = mrb_class_ptr(super);
}
c = mrb_class_new(mrb, s);
setup_class(mrb, outer, c, id);
}