Fix segfault on bad loop. Fixes #407.

This commit is contained in:
Calvin Rose 2020-05-19 09:45:45 -05:00
parent b7cfc08fc5
commit 0e828792ae
1 changed files with 2 additions and 2 deletions

View File

@ -625,8 +625,8 @@ static JanetSlot janetc_while(JanetFopts opts, int32_t argn, const Janet *argv)
subopts = janetc_fopts_default(c);
tempscope.flags |= JANET_SCOPE_UNUSED;
janetc_popscope(c);
janet_v__cnt(c->buffer) = labelwt;
janet_v__cnt(c->mapbuffer) = labelwt;
if (c->buffer) janet_v__cnt(c->buffer) = labelwt;
if (c->mapbuffer) janet_v__cnt(c->mapbuffer) = labelwt;
janetc_scope(&tempscope, c, JANET_SCOPE_FUNCTION, "while-iife");