git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/5] fast-import: check return value from unpack_entry()
@ 2008-02-14  6:34 Shawn O. Pearce
  0 siblings, 0 replies; only message in thread
From: Shawn O. Pearce @ 2008-02-14  6:34 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

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>
---
 fast-import.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/fast-import.c b/fast-import.c
index a523b17..9b71ccc 100644
--- a/fast-import.c
+++ b/fast-import.c
@@ -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);
-- 
1.5.4.1.1309.g833c2

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2008-02-14  6:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-14  6:34 [PATCH 1/5] fast-import: check return value from unpack_entry() Shawn O. Pearce

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).