diff src/misc2.c @ 7277:6600871bb38c v7.4.944

commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Nov 29 17:35:35 2015 +0100 patch 7.4.944 Problem: Writing tests for Vim script is hard. Solution: Add assertEqual(), assertFalse() and assertTrue() functions. Add the v:errors variable. Add the runtest script. Add a first new style test script.
author Christian Brabandt <cb@256bit.org>
date Sun, 29 Nov 2015 17:45:04 +0100
parents e036defe034e
children 1886f2863437
line wrap: on
line diff
--- a/src/misc2.c
+++ b/src/misc2.c
@@ -2092,6 +2092,7 @@ ga_concat_strings(gap, sep)
 
 /*
  * Concatenate a string to a growarray which contains characters.
+ * When "s" is NULL does not do anything.
  * Note: Does NOT copy the NUL at the end!
  */
     void
@@ -2099,8 +2100,11 @@ ga_concat(gap, s)
     garray_T	*gap;
     char_u	*s;
 {
-    int    len = (int)STRLEN(s);
-
+    int    len;
+
+    if (s == NULL)
+	return;
+    len = (int)STRLEN(s);
     if (ga_grow(gap, len) == OK)
     {
 	mch_memmove((char *)gap->ga_data + gap->ga_len, s, (size_t)len);