aboutsummaryrefslogtreecommitdiff
path: root/fsck-objects.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-05-03 21:17:45 -0700
committerJunio C Hamano <junkio@cox.net>2006-05-03 21:17:45 -0700
commit6d60bbefdc2a42614069024b0a38db8c2de33967 (patch)
tree478dff4b900cdd20cededf7e6dcac9ec124391ae /fsck-objects.c
parent00703e6d6822f81e7b22d079b7e6d9d044f46cf0 (diff)
downloadgit-6d60bbefdc2a42614069024b0a38db8c2de33967.tar.gz
git-6d60bbefdc2a42614069024b0a38db8c2de33967.tar.xz
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>
Diffstat (limited to 'fsck-objects.c')
-rw-r--r--fsck-objects.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/fsck-objects.c b/fsck-objects.c
index 98421aab3..1922b6d84 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)