From 6d60bbefdc2a42614069024b0a38db8c2de33967 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Wed, 3 May 2006 21:17:45 -0700 Subject: [PATCH] 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 --- fsck-objects.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fsck-objects.c b/fsck-objects.c index 98421aab..1922b6d8 100644 --- a/fsck-objects.c +++ b/fsck-objects.c @@ -446,6 +446,11 @@ static int fsck_cache_tree(struct cache_tree *it) if (0 <= it->entry_count) { struct object *obj = parse_object(it->sha1); + if (!obj) { + error("%s: invalid sha1 pointer in cache-tree", + sha1_to_hex(it->sha1)); + return 1; + } mark_reachable(obj, REACHABLE); obj->used = 1; if (obj->type != tree_type) -- 2.11.0