]> git.ipfire.org Git - thirdparty/git.git/commitdiff
fast-import: check return value from unpack_entry()
authorShawn O. Pearce <spearce@spearce.org>
Thu, 14 Feb 2008 06:34:34 +0000 (01:34 -0500)
committerJunio C Hamano <gitster@pobox.com>
Sat, 16 Feb 2008 04:11:51 +0000 (20:11 -0800)
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>
fast-import.c

index a523b171e22f83d6a656b372cf20afe52d27d1b2..9b71ccc479352c6a37b9b9652f1cb1793fdbb01b 100644 (file)
@@ -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);