fix(eval): fixup for empty modifier in fnamemodify (#16368)

* fix(eval): fixup for empty modifier in fnamemodify

1dbbaf89bf
erroneously removed a check for empty modifier and a PVS fix. 
Restore that check and fix.

Fixes #16367

Co-authored-by: zeertzjq <zeertzjq@outlook.com>
This commit is contained in:
Christian Clason 2021-11-19 16:13:49 +01:00 committed by GitHub
parent f71be1f87b
commit a7ad509902
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2663,12 +2663,12 @@ static void f_fnamemodify(typval_T *argvars, typval_T *rettv, FunPtr fptr)
char buf[NUMBUFLEN];
const char *fname = tv_get_string_chk(&argvars[0]);
const char *const mods = tv_get_string_buf_chk(&argvars[1], buf);
if (fname == NULL) {
if (mods == NULL || fname == NULL) {
fname = NULL;
} else if (mods != NULL && *mods != NUL) {
} else {
len = strlen(fname);
size_t usedlen = 0;
if (*mods != NUL) {
size_t usedlen = 0;
(void)modify_fname((char_u *)mods, false, &usedlen,
(char_u **)&fname, &fbuf, &len);
}