Skip to content

Commit

Permalink
parse_commit: don't fail, if object is NULL
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Martin Koegler authored and gitster committed Feb 19, 2008
1 parent 9684afd commit 9786f68
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions commit.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 9786f68

Please sign in to comment.