diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-07-14 21:00:41 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-07-14 21:00:41 +0200 |
commit | c816a2c22667108fcd61f445de2c926f78ff9fa7 (patch) | |
tree | f6b7fe9ee819ac64e1c2602a52c5c66ae1a0390d /src/time.c | |
parent | 4a0b85ad0193ac162e2d8458e4b1c5ad2e2b0193 (diff) |
patch 8.2.3161: Vim9: no error when reltime() has invalid argumentsv8.2.3161
Problem: Vim9: no error when reltime() has invalid arguments.
Solution: Add an error. (closes #8562)
Diffstat (limited to 'src/time.c')
-rw-r--r-- | src/time.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/time.c b/src/time.c index 6d4ad5d51e..02c5da9dd1 100644 --- a/src/time.c +++ b/src/time.c @@ -178,7 +178,11 @@ f_reltime(typval_T *argvars UNUSED, typval_T *rettv UNUSED) else if (argvars[1].v_type == VAR_UNKNOWN) { if (list2proftime(&argvars[0], &res) == FAIL) + { + if (in_vim9script()) + emsg(_(e_invarg)); return; + } profile_end(&res); } else @@ -186,7 +190,11 @@ f_reltime(typval_T *argvars UNUSED, typval_T *rettv UNUSED) // Two arguments: compute the difference. if (list2proftime(&argvars[0], &start) == FAIL || list2proftime(&argvars[1], &res) == FAIL) + { + if (in_vim9script()) + emsg(_(e_invarg)); return; + } profile_sub(&res, &start); } @@ -223,6 +231,8 @@ f_reltimefloat(typval_T *argvars UNUSED, typval_T *rettv) # ifdef FEAT_RELTIME if (list2proftime(&argvars[0], &tm) == OK) rettv->vval.v_float = profile_float(&tm); + else if (in_vim9script()) + emsg(_(e_invarg)); # endif } # endif @@ -242,6 +252,8 @@ f_reltimestr(typval_T *argvars UNUSED, typval_T *rettv) # ifdef FEAT_RELTIME if (list2proftime(&argvars[0], &tm) == OK) rettv->vval.v_string = vim_strsave((char_u *)profile_msg(&tm)); + else if (in_vim9script()) + emsg(_(e_invarg)); # endif } |