summaryrefslogtreecommitdiff
path: root/commit.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2019-10-07 02:32:58 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-10-07 02:32:58 (GMT)
commit80693e3f09ab80cfe4a5a83467e765626ad0b15a (patch)
tree1100110f21941cbe7510a43d41c8121d59761030 /commit.c
parentae203ba414f7e0b83f8b07255898a6cff3b5c07e (diff)
parent806278dead57766bf000af62dcb8892ee3a24956 (diff)
downloadgit-80693e3f09ab80cfe4a5a83467e765626ad0b15a.zip
git-80693e3f09ab80cfe4a5a83467e765626ad0b15a.tar.gz
git-80693e3f09ab80cfe4a5a83467e765626ad0b15a.tar.bz2
Merge branch 'tb/commit-graph-harden'
The code to parse and use the commit-graph file has been made more robust against corrupted input. * tb/commit-graph-harden: commit-graph.c: handle corrupt/missing trees commit-graph.c: handle commit parsing errors t/t5318: introduce failing 'git commit-graph write' tests
Diffstat (limited to 'commit.c')
-rw-r--r--commit.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/commit.c b/commit.c
index 3fe5f8f..40890ae 100644
--- a/commit.c
+++ b/commit.c
@@ -358,7 +358,8 @@ 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)