Skip to content

Commit 6064073

Browse files
committed
patch 8.1.1491: when skipping over code a function call may cause trouble
Problem: When skipping over code after an exception was thrown expression evaluation is aborted after a function call. (Ingo Karkat) Solution: Do not fail if not executing the expression. (closes #4507)
1 parent 4e0bf84 commit 6064073

3 files changed

Lines changed: 12 additions & 1 deletion

File tree

src/eval.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4592,7 +4592,7 @@ eval7(
45924592
/* Stop the expression evaluation when immediately
45934593
* aborting on error, or when an interrupt occurred or
45944594
* an exception was thrown but not caught. */
4595-
if (aborting())
4595+
if (evaluate && aborting())
45964596
{
45974597
if (ret == OK)
45984598
clear_tv(rettv);

src/testdir/test_eval_stuff.vim

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,3 +178,12 @@ func Test_scriptversion()
178178
call assert_fails('source Xversionscript', 'E999:')
179179
call delete('Xversionscript')
180180
endfunc
181+
182+
" Test fix for issue #4507
183+
func Test_skip_after_throw()
184+
try
185+
throw 'something'
186+
let x = wincol() || &ts
187+
catch /something/
188+
endtry
189+
endfunc

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -767,6 +767,8 @@ static char *(features[]) =
767767

768768
static int included_patches[] =
769769
{ /* Add new patch number below this line */
770+
/**/
771+
1491,
770772
/**/
771773
1490,
772774
/**/

0 commit comments

Comments
 (0)