summaryrefslogtreecommitdiffhomepage
path: root/src/class.c
diff options
context:
space:
mode:
authorYukihiro Matsumoto <[email protected]>2012-04-26 06:07:41 +0900
committerYukihiro Matsumoto <[email protected]>2012-04-26 06:07:41 +0900
commitc6f5f637e240e3363e79184653659c415551844a (patch)
tree3213292afd98ecf3364d7042ddd9b267e05b2042 /src/class.c
parente26bf08e3906d17bd1decd4dfe28067ab3948582 (diff)
downloadmruby-c6f5f637e240e3363e79184653659c415551844a.tar.gz
mruby-c6f5f637e240e3363e79184653659c415551844a.zip
supeclass type check prohibits class definition without superclass specified
Diffstat (limited to 'src/class.c')
-rw-r--r--src/class.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/class.c b/src/class.c
index f94508402..fadc56437 100644
--- a/src/class.c
+++ b/src/class.c
@@ -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);
}