summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Johannes Schindelin <Johannes.Schindelin@gmx.de>2006-05-07 17:42:37 +0200
committerLibravatar Junio C Hamano <junkio@cox.net>2006-05-07 13:54:46 -0700
commitb6c4a480b3161effaa3578df91d8cdc83044d7b6 (patch)
tree74235c0c92a2f9c4fe3f4b8f74799a2a9e24c37d
parentfsck-objects: do not segfault on missing tree in cache-tree (diff)
downloadtgif-b6c4a480b3161effaa3578df91d8cdc83044d7b6.tar.xz
Fix crash when reading the empty tree
cvsimport needs to call git-read-tree without arguments to create an empty tree. Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
-rw-r--r--read-tree.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/read-tree.c b/read-tree.c
index 067fb95e9d..49436bf96f 100644
--- a/read-tree.c
+++ b/read-tree.c
@@ -881,8 +881,8 @@ int main(int argc, char **argv)
* valid cache-tree because the index must match exactly
* what came from the tree.
*/
- if (trees->item && (!merge || (stage == 2))) {
- cache_tree_free(&active_cache_tree);
+ if (trees && trees->item && (!merge || (stage == 2))) {
+ cache_tree_free(&active_cache_tree);
prime_cache_tree();
}