Skip to content

Commit

Permalink
fast-import: check return value from unpack_entry()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Shawn O. Pearce authored and Junio C Hamano committed Feb 16, 2008
1 parent df93e33 commit e8b32e0
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fast-import.c
Original file line number Diff line number Diff line change
Expand Up @@ -1204,6 +1204,8 @@ static void load_tree(struct tree_entry *root)
die("Not a tree: %s", sha1_to_hex(sha1));
t->delta_depth = myoe->depth;
buf = gfi_unpack_entry(myoe, &size);
if (!buf)
die("Can't load tree %s", sha1_to_hex(sha1));
} else {
enum object_type type;
buf = read_sha1_file(sha1, &type, &size);
Expand Down

0 comments on commit e8b32e0

Please sign in to comment.