indexer: don't segfault when freeing an unused indexer Make sure that idx->pack isn't NULL before trying to free resources under it.
diff --git a/src/indexer.c b/src/indexer.c
index 30c6469..719f54e 100644
--- a/src/indexer.c
+++ b/src/indexer.c
@@ -587,9 +587,11 @@ void git_indexer_stream_free(git_indexer_stream *idx)
git_vector_foreach(&idx->objects, i, e)
git__free(e);
git_vector_free(&idx->objects);
- git_vector_foreach(&idx->pack->cache, i, pe)
- git__free(pe);
- git_vector_free(&idx->pack->cache);
+ if (idx->pack) {
+ git_vector_foreach(&idx->pack->cache, i, pe)
+ git__free(pe);
+ git_vector_free(&idx->pack->cache);
+ }
git_vector_foreach(&idx->deltas, i, delta)
git__free(delta);
git_vector_free(&idx->deltas);