parse_commit: don't fail, if object is NULL
authorMartin Koegler <mkoegler@auto.tuwien.ac.at>
Mon, 18 Feb 2008 20:48:02 +0000 (21:48 +0100)
committerJunio C Hamano <gitster@pobox.com>
Tue, 19 Feb 2008 03:25:26 +0000 (19:25 -0800)
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>
commit.c

index 70f12664cecbd411092703df6eae7f13e50f37fa..5d57450de36911ccc37db95cc0701d242cb0ef04 100644 (file)
--- 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);