aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/garray.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/garray.c')
-rw-r--r--src/nvim/garray.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/nvim/garray.c b/src/nvim/garray.c
index 75c3fb9a73..e6cbd9332b 100644
--- a/src/nvim/garray.c
+++ b/src/nvim/garray.c
@@ -174,6 +174,7 @@ char_u* ga_concat_strings(const garray_T *gap) FUNC_ATTR_NONNULL_RET
}
/// Concatenate a string to a growarray which contains characters.
+/// When "s" is NULL does not do anything.
///
/// WARNING:
/// - Does NOT copy the NUL at the end!
@@ -183,6 +184,10 @@ char_u* ga_concat_strings(const garray_T *gap) FUNC_ATTR_NONNULL_RET
/// @param s
void ga_concat(garray_T *gap, const char_u *restrict s)
{
+ if (s == NULL) {
+ return;
+ }
+
int len = (int)strlen((char *) s);
if (len) {
ga_grow(gap, len);