Skip to content

Commit

Permalink
Check if sc->mt is initialized before copying it.
Browse files Browse the repository at this point in the history
  • Loading branch information
clayton-shopify committed Apr 18, 2017
1 parent 79e0314 commit de96994
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/kernel.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down

0 comments on commit de96994

Please sign in to comment.