summaryrefslogtreecommitdiff
path: root/commit.c
diff options
context:
space:
mode:
authorMartin Koegler <mkoegler@auto.tuwien.ac.at>2008-02-18 20:48:02 (GMT)
committerJunio C Hamano <gitster@pobox.com>2008-02-19 03:25:26 (GMT)
commit9786f68bfcc082778aee74159540e341bb239514 (patch)
treed2a1d81c7d446a8199ca07d08fce9963270375f6 /commit.c
parent9684afd967f61047bbf1b3a8039adf7d41916b31 (diff)
downloadgit-9786f68bfcc082778aee74159540e341bb239514.zip
git-9786f68bfcc082778aee74159540e341bb239514.tar.gz
git-9786f68bfcc082778aee74159540e341bb239514.tar.bz2
parse_commit: don't fail, if object is NULL
Some codepaths (eg. builtin-rev-parse -> get_merge_bases -> parse_commit) can pass NULL. Signed-off-by: Martin Koegler <mkoegler@auto.tuwien.ac.at> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'commit.c')
-rw-r--r--commit.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/commit.c b/commit.c
index 70f1266..5d57450 100644
--- a/commit.c
+++ b/commit.c
@@ -311,6 +311,8 @@ int parse_commit(struct commit *item)
unsigned long size;
int ret;
+ if (!item)
+ return -1;
if (item->object.parsed)
return 0;
buffer = read_sha1_file(item->object.sha1, &type, &size);