summaryrefslogtreecommitdiff
path: root/src/strv.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/strv.c')
-rw-r--r--src/strv.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/strv.c b/src/strv.c
index c5f8df06da..c8ebb648d6 100644
--- a/src/strv.c
+++ b/src/strv.c
@@ -70,9 +70,10 @@ char **strv_copy(char **l) {
if (!(r = new(char*, strv_length(l)+1)))
return NULL;
- for (k = r; *l; k++, l++)
- if (!(*k = strdup(*l)))
- goto fail;
+ if (l)
+ for (k = r; *l; k++, l++)
+ if (!(*k = strdup(*l)))
+ goto fail;
*k = NULL;
return r;