mirror of
https://github.com/vim/vim.git
synced 2025-08-31 20:53:42 -04:00
patch 8.2.0896: crash when calling searchcount() with a string
Problem: Crash when calling searchcount() with a string. Solution: Check the argument is a dict. (closes #6192)
This commit is contained in:
parent
408c23b079
commit
14681627f3
@ -4072,11 +4072,17 @@ f_searchcount(typval_T *argvars, typval_T *rettv)
|
||||
|
||||
if (argvars[0].v_type != VAR_UNKNOWN)
|
||||
{
|
||||
dict_T *dict = argvars[0].vval.v_dict;
|
||||
dict_T *dict;
|
||||
dictitem_T *di;
|
||||
listitem_T *li;
|
||||
int error = FALSE;
|
||||
|
||||
if (argvars[0].v_type != VAR_DICT || argvars[0].vval.v_dict == NULL)
|
||||
{
|
||||
emsg(_(e_dictreq));
|
||||
return;
|
||||
}
|
||||
dict = argvars[0].vval.v_dict;
|
||||
di = dict_find(dict, (char_u *)"timeout", -1);
|
||||
if (di != NULL)
|
||||
{
|
||||
|
@ -259,6 +259,10 @@ func Test_search_stat()
|
||||
bwipe!
|
||||
endfunc
|
||||
|
||||
func Test_searchcount_fails()
|
||||
call assert_fails('echo searchcount("boo!")', 'E715:')
|
||||
endfunc
|
||||
|
||||
func Test_search_stat_foldopen()
|
||||
CheckScreendump
|
||||
|
||||
|
@ -746,6 +746,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
896,
|
||||
/**/
|
||||
895,
|
||||
/**/
|
||||
|
Loading…
x
Reference in New Issue
Block a user