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>
This commit is contained in:
Martin Koegler 2008-02-18 21:48:02 +01:00 committed by Junio C Hamano
parent 9684afd967
commit 9786f68bfc

View File

@ -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);