Fix crash when reading the empty tree
authorJohannes Schindelin <Johannes.Schindelin@gmx.de>
Sun, 7 May 2006 15:42:37 +0000 (17:42 +0200)
committerJunio C Hamano <junkio@cox.net>
Sun, 7 May 2006 20:54:46 +0000 (13:54 -0700)
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>
read-tree.c

index 067fb95..49436bf 100644 (file)
@@ -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();
        }