Created
July 12, 2013 13:26
-
-
Save wanabe/5984443 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/src/class.c b/src/class.c | |
| index a50d3d8..9080265 100644 | |
| --- a/src/class.c | |
| +++ b/src/class.c | |
| @@ -78,8 +78,14 @@ prepare_singleton_class(mrb_state *mrb, struct RBasic *o) | |
| } | |
| else if (o->tt == MRB_TT_SCLASS) { | |
| c = (struct RClass*)o; | |
| - make_metaclass(mrb, c->super); | |
| - sc->super = c->super->c; | |
| + while (c->tt != MRB_TT_CLASS) { | |
| + c = c->super; | |
| + if (!c) { | |
| + mrb_bug(mrb, "corrupted class chain!"); | |
| + } | |
| + } | |
| + make_metaclass(mrb, c); | |
| + sc->super = c->c; | |
| } | |
| else { | |
| sc->super = o->c; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment