treebuilder: prevent git_treebuilder_free() from segfaulting when being passed a NULL treebuilder
diff --git a/src/tree.c b/src/tree.c
index 92b1b1e..9283a1a 100644
--- a/src/tree.c
+++ b/src/tree.c
@@ -634,6 +634,9 @@ void git_treebuilder_clear(git_treebuilder *bld)
void git_treebuilder_free(git_treebuilder *bld)
{
+ if (bld == NULL)
+ return;
+
git_treebuilder_clear(bld);
git_vector_free(&bld->entries);
git__free(bld);