Check lv before printing local variable names.

This commit is contained in:
Yukihiro "Matz" Matsumoto
2020-07-22 14:20:08 +09:00
parent 8b3f3c0bf3
commit ff0e3bcea6
+1
View File
@@ -11,6 +11,7 @@ print_r(mrb_state *mrb, const mrb_irep *irep, size_t n)
{
if (n == 0) return;
if (n > irep->nlocals) return;
if (!irep->lv[n-1]) return;
printf(" R%d:%s", (int)n, mrb_sym_dump(mrb, irep->lv[n-1]));
}