@matheusbsbs / matheus-bagliano / commits / 9786f68bfc
Fork 0

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>

Martin Koegler committed Feb 18, 2008 at 21:48 UTC 9786f68bfcc082778aee74159540e341bb239514
1 file changed +2
commit.c
+2
@@ -311,6 +311,8 @@ int parse_commit(struct commit *item)
311 unsigned long size;
312 int ret;
313
314 + if (!item)
315 + return -1;
316 if (item->object.parsed)
317 return 0;
318 buffer = read_sha1_file(item->object.sha1, &type, &size);