aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Clason <c.clason@uni-graz.at>2021-11-19 16:13:49 +0100
committerGitHub <noreply@github.com>2021-11-19 16:13:49 +0100
commita7ad50990228c4ed2f22ba334a11903fc7f81260 (patch)
treecfa751b3c47c6f4d8fd952d5064ab650bfbb74ba /src
parentf71be1f87b40bf863b6cf6b4fbcebffdd3297d88 (diff)
downloadrneovim-a7ad50990228c4ed2f22ba334a11903fc7f81260.tar.gz
rneovim-a7ad50990228c4ed2f22ba334a11903fc7f81260.tar.bz2
rneovim-a7ad50990228c4ed2f22ba334a11903fc7f81260.zip
fix(eval): fixup for empty modifier in fnamemodify (#16368)
* fix(eval): fixup for empty modifier in fnamemodify https://github.com/neovim/neovim/commit/1dbbaf89bf5d3bcd1edac3af9938c2e2dd18f816 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>
Diffstat (limited to 'src')
-rw-r--r--src/nvim/eval/funcs.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c
index 7549ec7ac8..6001440888 100644
--- a/src/nvim/eval/funcs.c
+++ b/src/nvim/eval/funcs.c
@@ -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);
}