0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

patch 9.0.1363: crash when :def function has :break in skipped block

Problem:    Crash when :def function has :break in skipped block. (Ernie Rael)
Solution:   Don't generate a jump for a skipped :break. (closes #12077)
This commit is contained in:
Bram Moolenaar
2023-02-27 22:06:51 +00:00
parent 99ad3a8bb9
commit 3f45d67a15
3 changed files with 31 additions and 1 deletions

View File

@@ -1440,6 +1440,9 @@ compile_break(char_u *arg, cctx_T *cctx)
e_break_without_while_or_for, cctx) == FAIL)
return NULL;
if (cctx->ctx_skip == SKIP_YES)
return arg;
if (try_scopes > 0)
// Inside one or more try/catch blocks we first need to jump to the
// "finally" or "endtry" to cleanup. Then come to the next JUMP
@@ -1449,7 +1452,7 @@ compile_break(char_u *arg, cctx_T *cctx)
// Jump to the end of the FOR or WHILE loop. The instruction index will be
// filled in later.
if (compile_jump_to_end(el, JUMP_ALWAYS, 0, cctx) == FAIL)
return FAIL;
return NULL;
return arg;
}