summaryrefslogtreecommitdiff
path: root/src/userfunc.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-07-28 19:34:14 +0200
committerBram Moolenaar <Bram@vim.org>2021-07-28 19:34:14 +0200
commit327d3ee4557027b51aad86e68743a85ed3a6f52b (patch)
tree92a08a5c1de1827d66f41b5a09ce6aac3ac9b57b /src/userfunc.c
parenteaf3f36168f85c8e0ab7083cd996b9fbe937045d (diff)
downloadvim-git-327d3ee4557027b51aad86e68743a85ed3a6f52b.tar.gz
patch 8.2.3237: when a builtin function gives an error processing continuesv8.2.3237
Problem: When a builtin function gives an error processing continues. Solution: In Vim9 script return FAIL in get_func_tv().
Diffstat (limited to 'src/userfunc.c')
-rw-r--r--src/userfunc.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/userfunc.c b/src/userfunc.c
index e00871883..2adef7c18 100644
--- a/src/userfunc.c
+++ b/src/userfunc.c
@@ -1674,7 +1674,8 @@ get_func_tv(
if (ret == OK)
{
- int i = 0;
+ int i = 0;
+ int did_emsg_before = did_emsg;
if (get_vim_var_nr(VV_TESTING))
{
@@ -1689,6 +1690,10 @@ get_func_tv(
}
ret = call_func(name, len, rettv, argcount, argvars, funcexe);
+ if (in_vim9script() && did_emsg > did_emsg_before)
+ // An error in a builtin function does not return FAIL, but we do
+ // want to abort further processing if an error was given.
+ ret = FAIL;
funcargs.ga_len -= i;
}