From 4d396271e1b650f1225ea27240af8616283cfa39 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Fri, 2 Apr 2021 08:27:53 -0400 Subject: [PATCH] clang/API: copy "" if orig_save is NULL orig_save can be NULL if ExpandOne() is misused if ExpandOne() is first called with mode "WILD_CANCEL" or "WILD_APPLY" before other modes. --- src/nvim/ex_getln.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index 76df01c205..38385d19b2 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -4093,9 +4093,10 @@ ExpandOne ( } if (mode == WILD_CANCEL) { - ss = vim_strsave(orig_save); + ss = vim_strsave(orig_save ? orig_save : (char_u *)""); } else if (mode == WILD_APPLY) { - ss = vim_strsave(findex == -1 ? orig_save : xp->xp_files[findex]); + ss = vim_strsave(findex == -1 ? (orig_save ? orig_save : (char_u *)"") : + xp->xp_files[findex]); } /* free old names */