mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:8.2.3470: crash with error in :catch and also in :finally
Problem: Crash with error in :catch and also in :finally.
Solution: Only discard an exception if there is one. (closes vim/vim#8954)
a684a68409
This commit is contained in:
parent
93c72d866b
commit
a25c35d6e4
@ -1913,7 +1913,7 @@ int cleanup_conditionals(cstack_T *cstack, int searched_cond, int inclusive)
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
if (cstack->cs_flags[idx] & CSF_FINALLY) {
|
if (cstack->cs_flags[idx] & CSF_FINALLY) {
|
||||||
if (cstack->cs_pending[idx] & CSTP_THROW) {
|
if ((cstack->cs_pending[idx] & CSTP_THROW) && cstack->cs_exception[idx] != NULL) {
|
||||||
// Cancel the pending exception. This is in the
|
// Cancel the pending exception. This is in the
|
||||||
// finally clause, so that the stack of the
|
// finally clause, so that the stack of the
|
||||||
// caught exceptions is not involved.
|
// caught exceptions is not involved.
|
||||||
|
@ -2045,6 +2045,18 @@ func Test_user_command_function_call_with_endtry()
|
|||||||
call delete('XtestThrow')
|
call delete('XtestThrow')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func ThisWillFail()
|
||||||
|
try
|
||||||
|
if x | endif
|
||||||
|
catch
|
||||||
|
for l in []
|
||||||
|
finally
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
func Test_error_in_catch_and_finally()
|
||||||
|
call assert_fails('call ThisWillFail()', ['E121:', 'E600:'])
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
|
||||||
" Modeline {{{1
|
" Modeline {{{1
|
||||||
" vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker
|
" vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker
|
||||||
|
Loading…
Reference in New Issue
Block a user