@matheusbsbs / matheus-bagliano / commits / 6d60bbefdc
Fork 0

fsck-objects: do not segfault on missing tree in cache-tree

Even if trees are missing in cache-tree, we should continue and check the rest of the object database. Signed-off-by: Junio C Hamano <junkio@cox.net>

Junio C Hamano committed May 3, 2006 at 21:17 UTC 6d60bbefdc2a42614069024b0a38db8c2de33967
1 file changed +5
fsck-objects.c
+5
@@ -446,6 +446,11 @@ static int fsck_cache_tree(struct cache_tree *it)
446
447 if (0 <= it->entry_count) {
448 struct object *obj = parse_object(it->sha1);
449 + if (!obj) {
450 + error("%s: invalid sha1 pointer in cache-tree",
451 + sha1_to_hex(it->sha1));
452 + return 1;
453 + }
454 mark_reachable(obj, REACHABLE);
455 obj->used = 1;
456 if (obj->type != tree_type)