diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-10-10 16:08:16 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-10-10 16:08:16 +0100 |
commit | 801cd35e7e3b21e519e12a1610ee1d721e40893e (patch) | |
tree | 5b24a4313fbbc3821aaf236b3cd6163828d26267 /src/typval.c | |
parent | 1206c163dbc8caace86e53f375f298af6cfab75a (diff) |
patch 9.0.0715: wrong argument for append() gives two error messagesv9.0.0715
Problem: Wrong argument for append() gives two error messages.
Solution: When getting an error for a number argument don't try using it as
a string. (closes #11335)
Diffstat (limited to 'src/typval.c')
-rw-r--r-- | src/typval.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/typval.c b/src/typval.c index a4fdb782f1..d6f6196b58 100644 --- a/src/typval.c +++ b/src/typval.c @@ -2509,10 +2509,12 @@ eval_env_var(char_u **arg, typval_T *rettv, int evaluate) tv_get_lnum(typval_T *argvars) { linenr_T lnum = -1; + int did_emsg_before = did_emsg; if (argvars[0].v_type != VAR_STRING || !in_vim9script()) lnum = (linenr_T)tv_get_number_chk(&argvars[0], NULL); - if (lnum <= 0 && argvars[0].v_type != VAR_NUMBER) + if (lnum <= 0 && did_emsg_before == did_emsg + && argvars[0].v_type != VAR_NUMBER) { int fnum; pos_T *fp; |