From 38c4a3170b793ae69a82612f420fed8a1d0d67c3 Mon Sep 17 00:00:00 2001 From: Yukihiro Matsumoto Date: Thu, 16 Aug 2012 22:24:13 +0900 Subject: outer might be NULL; close #428 --- src/variable.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src') 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); } -- cgit v1.2.3