1
0
forked from aniani/vim

patch 8.2.2133: Vim9: checking for a non-empty string is too strict

Problem:    Vim9: checking for a non-empty string is too strict.
Solution:   Check for any string. (closes #7447)
This commit is contained in:
Bram Moolenaar
2020-12-12 18:58:40 +01:00
parent 3ae50c775c
commit 2a9d5d386b
6 changed files with 59 additions and 24 deletions

View File

@@ -876,7 +876,7 @@ f_exepath(typval_T *argvars, typval_T *rettv)
{
char_u *p = NULL;
if (in_vim9script() && check_for_string(&argvars[0]) == FAIL)
if (in_vim9script() && check_for_nonempty_string(&argvars[0]) == FAIL)
return;
(void)mch_can_exe(tv_get_string(&argvars[0]), &p, TRUE);
rettv->v_type = VAR_STRING;
@@ -942,7 +942,7 @@ findfilendir(
rettv->vval.v_string = NULL;
rettv->v_type = VAR_STRING;
if (in_vim9script() && check_for_string(&argvars[0]) == FAIL)
if (in_vim9script() && check_for_nonempty_string(&argvars[0]) == FAIL)
return;
#ifdef FEAT_SEARCHPATH
@@ -1028,9 +1028,9 @@ f_fnamemodify(typval_T *argvars, typval_T *rettv)
return;
fname = tv_get_string_chk(&argvars[0]);
mods = tv_get_string_buf_chk(&argvars[1], buf);
if (fname == NULL || mods == NULL)
if (fname == NULL)
fname = NULL;
else
else if (mods != NULL && *mods != NUL)
{
len = (int)STRLEN(fname);
(void)modify_fname(mods, FALSE, &usedlen, &fname, &fbuf, &len);