util: handle NULL pointers passed to git_strarray_free() Signed-off-by: Brodie Rao <brodie@sf.io>
diff --git a/src/util.c b/src/util.c
index 81a64c7..f977a9b 100644
--- a/src/util.c
+++ b/src/util.c
@@ -140,6 +140,10 @@ int git_libgit2_opts(int key, ...)
void git_strarray_free(git_strarray *array)
{
size_t i;
+
+ if (array == NULL)
+ return;
+
for (i = 0; i < array->count; ++i)
git__free(array->strings[i]);