Mercurial > vim
diff src/testdir/test_trycatch.vim @ 25905:892f937358ea v8.2.3486
patch 8.2.3486: illegal memory access with invalid sequence of commands
Commit: https://github.com/vim/vim/commit/cce81e9673fe8d056e8eef310d9919620eccb2f2
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Oct 6 22:08:11 2021 +0100
patch 8.2.3486: illegal memory access with invalid sequence of commands
Problem: Illegal memory access with invalid sequence of commands.
Solution: Do not call leave_block() when not in a try block. (closes https://github.com/vim/vim/issues/8966)
Reset did_emsg so that exception is shown as an error.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 06 Oct 2021 23:15:04 +0200 |
parents | 51694ef3902e |
children | 485c7c4afeb7 |
line wrap: on
line diff
--- a/src/testdir/test_trycatch.vim +++ b/src/testdir/test_trycatch.vim @@ -2295,5 +2295,25 @@ func Test_error_in_catch_and_finally() call delete('XtestCatchAndFinally') endfunc +" This was causing an illegal memory access +func Test_leave_block_in_endtry_not_called() + let lines =<< trim END + vim9script + try # + for x in [] + if + endwhile + if + endtry + END + call writefile(lines, 'XtestEndtry') + try + source XtestEndtry + catch /E171:/ + endtry + + call delete('XtestEndtry') +endfunc + " Modeline {{{1 " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker