diff options
Diffstat (limited to 'src/eval.c')
-rw-r--r-- | src/eval.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/eval.c b/src/eval.c index 2fbd867aba..9ca805061d 100644 --- a/src/eval.c +++ b/src/eval.c @@ -7312,6 +7312,11 @@ do_string_sub( * - The text after the match. */ sublen = vim_regsub(®match, sub, expr, tail, 0, REGSUB_MAGIC); + if (sublen <= 0) + { + ga_clear(&ga); + break; + } if (ga_grow(&ga, (int)((end - tail) + sublen - (regmatch.endp[0] - regmatch.startp[0]))) == FAIL) { |