summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/variable.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/variable.c b/src/variable.c
index 9b233cde8..6d0ab7557 100644
--- a/src/variable.c
+++ b/src/variable.c
@@ -905,13 +905,16 @@ mrb_class_sym(mrb_state *mrb, struct RClass *c, struct RClass *outer)
name = mrb_obj_iv_get(mrb, (struct RObject*)c, mrb_intern(mrb, "__classid__"));
if (mrb_nil_p(name)) {
- struct csym_arg arg;
- arg.c = c;
- arg.sym = 0;
+ if (!outer) return 0;
+ else {
+ struct csym_arg arg;
- iv_foreach(mrb, outer->iv, csym_i, &arg);
- return arg.sym;
+ arg.c = c;
+ arg.sym = 0;
+ iv_foreach(mrb, outer->iv, csym_i, &arg);
+ return arg.sym;
+ }
}
return SYM2ID(name);
}