aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/strings.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/strings.c')
-rw-r--r--src/nvim/strings.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/nvim/strings.c b/src/nvim/strings.c
index 16ae35272b..485551da6e 100644
--- a/src/nvim/strings.c
+++ b/src/nvim/strings.c
@@ -266,11 +266,11 @@ char *vim_strsave_shellescape(const char *string, bool do_special, bool do_newli
*d++ = *p++;
continue;
}
- if (do_special && find_cmdline_var(p, &l) >= 0) {
+ if (do_special && find_cmdline_var(p, &l) >= 0 && l > 0) {
*d++ = '\\'; // insert backslash
- while (--l != SIZE_MAX) { // copy the var
+ do { // copy the var
*d++ = *p++;
- }
+ } while (--l > 0);
continue;
}
if (*p == '\\' && fish_like) {