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 #8954)
diff --git a/src/testdir/test_trycatch.vim b/src/testdir/test_trycatch.vim
index 052fab7..ac12671 100644
--- a/src/testdir/test_trycatch.vim
+++ b/src/testdir/test_trycatch.vim
@@ -2273,6 +2273,18 @@
call delete('XtestThrow')
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
" vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker