]> git.ipfire.org Git - thirdparty/git.git/blobdiff - commit.c
Merge branch 'bw/format-patch-o-create-leading-dirs'
[thirdparty/git.git] / commit.c
index a98de16e3d570e09696a844b018bd4d580d9a30e..40890ae7ce8a48a2da06bcde6fc5a9db77260707 100644 (file)
--- a/commit.c
+++ b/commit.c
@@ -358,14 +358,15 @@ struct tree *repo_get_commit_tree(struct repository *r,
 
 struct object_id *get_commit_tree_oid(const struct commit *commit)
 {
-       return &get_commit_tree(commit)->object.oid;
+       struct tree *tree = get_commit_tree(commit);
+       return tree ? &tree->object.oid : NULL;
 }
 
 void release_commit_memory(struct parsed_object_pool *pool, struct commit *c)
 {
        set_commit_tree(c, NULL);
-       c->index = 0;
        free_commit_buffer(pool, c);
+       c->index = 0;
        free_commit_list(c->parents);
 
        c->object.parsed = 0;