This fixes possible crashes in case of broken commit tree, and makes
rev-tree die in case it cannot parse a given commit.
struct commit_list *parents;
struct commit *obj = lookup_commit(sha1);
- if (obj->object.parsed)
+ if (obj && obj->object.parsed)
return;
+ if (!obj || parse_commit(obj))
+ die("unable to parse commit (%s)", sha1_to_hex(sha1));
- parse_commit(obj);
-
parents = obj->parents;
while (parents) {
process_commit(parents->item->object.sha1);