fix gc bug: ci->env and env-up are nullable

This commit is contained in:
Yuichi Nishiwaki
2013-10-29 16:39:57 +09:00
parent 787dae1fe5
commit 35bbd66812
2 changed files with 7 additions and 2 deletions
+6 -2
View File
@@ -162,7 +162,9 @@ gc_mark_object(pic_state *pic, struct pic_object *obj)
for (i = 0; i < env->num_val; ++i) {
gc_mark(pic, env->values[i]);
}
gc_mark_object(pic, (struct pic_object *)env->up);
if (env->up) {
gc_mark_object(pic, (struct pic_object *)env->up);
}
break;
}
case PIC_TT_PROC: {
@@ -222,7 +224,9 @@ gc_mark_phase(pic_state *pic)
/* callinfo */
for (ci = pic->ci; ci != pic->cibase; --ci) {
gc_mark_object(pic, (struct pic_object *)ci->env);
if (ci->env) {
gc_mark_object(pic, (struct pic_object *)ci->env);
}
}
/* arena */