summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <junkio@cox.net>2006-05-04 00:17:28 -0700
committerLibravatar Junio C Hamano <junkio@cox.net>2006-05-04 00:17:28 -0700
commit25a9ff836f638d3290eb9648aa011db4f8e7ed90 (patch)
tree59a4eefa9d75e42bc025b914cd4ff80d1f1458e8
parentMerge branch 'jc/grep' into next (diff)
parentfsck-objects: do not segfault on missing tree in cache-tree (diff)
downloadtgif-25a9ff836f638d3290eb9648aa011db4f8e7ed90.tar.xz
Merge branch 'jc/cache-tree' into next
* jc/cache-tree: fsck-objects: do not segfault on missing tree in cache-tree
-rw-r--r--fsck-objects.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/fsck-objects.c b/fsck-objects.c
index 98421aab30..1922b6d84c 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)