Permalink
Browse files

The attached object may not be a class; fix #3602

  • Loading branch information...
matz committed Apr 12, 2017
1 parent 6dd1a57 commit a25404c3057f89e8d1f17a05ef4473b8f1c8fe94
Showing with 9 additions and 1 deletion.
  1. +9 −1 src/class.c
View
@@ -137,7 +137,15 @@ mrb_class_outer_module(mrb_state *mrb, struct RClass *c)
mrb_value klass;
klass = mrb_obj_iv_get(mrb, (struct RObject *)cls,
mrb_intern_lit(mrb, "__attached__"));
cls = mrb_class_ptr(klass);
switch (mrb_type(klass)) {
case MRB_TT_CLASS:
case MRB_TT_SCLASS:
case MRB_TT_MODULE:
cls = mrb_class_ptr(klass);
break;
default:
break;
}
}
return cls;
}

0 comments on commit a25404c

Please sign in to comment.