diff options
author | Bram Moolenaar <Bram@vim.org> | 2018-06-24 19:01:59 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2018-06-24 19:01:59 +0200 |
commit | 3dddb09c98825acefa6f2d94bb369b8e00d7b3e5 (patch) | |
tree | 157ed0076c22b082eb97d422583287abde42b572 /src/evalfunc.c | |
parent | d1d037e90192ab64e4cec00b9d008b33bc69d979 (diff) |
patch 8.1.0112: no error when using bad arguments with searchpair()v8.1.0112
Problem: No error when using bad arguments with searchpair().
Solution: Add error messages.
Diffstat (limited to 'src/evalfunc.c')
-rw-r--r-- | src/evalfunc.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/evalfunc.c b/src/evalfunc.c index 0cd7527f77..cec6dabb4a 100644 --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -10152,7 +10152,8 @@ searchpair_cmn(typval_T *argvars, pos_T *match_pos) long lnum_stop = 0; long time_limit = 0; - /* Get the three pattern arguments: start, middle, end. */ + /* Get the three pattern arguments: start, middle, end. Will result in an + * error if not a valid argument. */ spat = get_tv_string_chk(&argvars[0]); mpat = get_tv_string_buf_chk(&argvars[1], nbuf1); epat = get_tv_string_buf_chk(&argvars[2], nbuf2); @@ -10189,19 +10190,26 @@ searchpair_cmn(typval_T *argvars, pos_T *match_pos) && skip->v_type != VAR_STRING) { /* Type error */ + EMSG2(_(e_invarg2), get_tv_string(&argvars[4])); goto theend; } if (argvars[5].v_type != VAR_UNKNOWN) { lnum_stop = (long)get_tv_number_chk(&argvars[5], NULL); if (lnum_stop < 0) + { + EMSG2(_(e_invarg2), get_tv_string(&argvars[5])); goto theend; + } #ifdef FEAT_RELTIME if (argvars[6].v_type != VAR_UNKNOWN) { time_limit = (long)get_tv_number_chk(&argvars[6], NULL); if (time_limit < 0) + { + EMSG2(_(e_invarg2), get_tv_string(&argvars[6])); goto theend; + } } #endif } |