Permalink
Browse files

Check if sc->mt is initialized before copying it.

  • Loading branch information...
clayton-shopify committed Apr 18, 2017
1 parent 79e0314 commit de969942338ac440294eefb2e7846a6975f4efdd
Showing with 6 additions and 1 deletion.
  1. +6 −1 src/kernel.c
View
@@ -241,7 +241,12 @@ copy_class(mrb_state *mrb, mrb_value dst, mrb_value src)
c1->super = mrb_class_ptr(mrb_obj_dup(mrb, mrb_obj_value(c0)));
c1->super->flags |= MRB_FLAG_IS_ORIGIN;
}
dc->mt = kh_copy(mt, mrb, sc->mt);
if (sc->mt) {
dc->mt = kh_copy(mt, mrb, sc->mt);
}
else {
dc->mt = kh_init(mt, mrb);
}
dc->super = sc->super;
MRB_SET_INSTANCE_TT(dc, MRB_INSTANCE_TT(sc));
}

0 comments on commit de96994

Please sign in to comment.