diff options
Diffstat (limited to 'src/ex_eval.c')
-rw-r--r-- | src/ex_eval.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/ex_eval.c b/src/ex_eval.c index 7b4ac1750d..f3e2ca28cf 100644 --- a/src/ex_eval.c +++ b/src/ex_eval.c @@ -1124,10 +1124,13 @@ ex_else(exarg_T *eap) skip = TRUE; } - // Variables declared in the previous block can no longer be - // used. Needs to be done before setting "cs_flags". - leave_block(cstack); - enter_block(cstack); + if (cstack->cs_idx >= 0) + { + // Variables declared in the previous block can no longer be + // used. Needs to be done before setting "cs_flags". + leave_block(cstack); + enter_block(cstack); + } // if skipping or the ":if" was TRUE, reset ACTIVE, otherwise set it if (skip || cstack->cs_flags[cstack->cs_idx] & CSF_TRUE) |