0
0
mirror of https://github.com/vim/vim.git synced 2025-07-04 23:07:33 -04:00

Add error check

This commit is contained in:
Shougo Matsushita 2025-06-26 09:22:08 +09:00
parent 8e14d12635
commit 8e58fc0268
2 changed files with 3 additions and 0 deletions

View File

@ -4542,6 +4542,8 @@ f_getcompltype(typval_T *argvars, typval_T *rettv)
return; return;
pat = tv_get_string(&argvars[0]); pat = tv_get_string(&argvars[0]);
if (check_for_string_arg(argvars, 0) == FAIL)
return;
ExpandInit(&xpc); ExpandInit(&xpc);

View File

@ -4591,6 +4591,7 @@ func Test_range_complete()
endfunc endfunc
func Test_getcompltype() func Test_getcompltype()
call assert_fails('call getcompltype({})', 'E731:')
call assert_equal(getcompltype(''), 'command') call assert_equal(getcompltype(''), 'command')
call assert_equal(getcompltype('dummy '), '') call assert_equal(getcompltype('dummy '), '')
call assert_equal(getcompltype('cd '), 'dir_in_path') call assert_equal(getcompltype('cd '), 'dir_in_path')