fast-import: check return value from unpack_entry()
If the tree object we have asked for is deltafied in the packfile and the delta did not apply correctly or was not able to be decompressed from the packfile then we can get back NULL instead of the tree data. This is (part of) the reason why read_sha1_file() can return NULL, so we need to also handle it the same way. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Shawn O. Pearce committed
Feb 14, 2008 at 01:34 UTC
e8b32e061006d1a62e464e7c2a5385ddd0cb4290
1 file changed
+2
fast-import.c
+2
@@ -1204,6 +1204,8 @@ static void load_tree(struct tree_entry *root)
1204
die("Not a tree: %s", sha1_to_hex(sha1));
1205
t->delta_depth = myoe->depth;
1206
buf = gfi_unpack_entry(myoe, &size);
1207
+ if (!buf)
1208
+ die("Can't load tree %s", sha1_to_hex(sha1));
1209
} else {
1210
enum object_type type;
1211
buf = read_sha1_file(sha1, &type, &size);