Code

Tree view: improve handling of empty trees
authorJonas Fonseca <fonseca@diku.dk>
Tue, 3 Feb 2009 21:34:44 +0000 (22:34 +0100)
committerJonas Fonseca <fonseca@diku.dk>
Tue, 3 Feb 2009 21:34:44 +0000 (22:34 +0100)
NEWS
tig.c

diff --git a/NEWS b/NEWS
index 7f8e98e406223a538ac5489708003b4efe90d312..733c98b811a2f836dea3d858dfeca4e0bb12574b 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -27,6 +27,7 @@ Improvements:
 Bug fixes:
 
  - Tree view: fix memory corruption bug when updating.
+ - Tree view: improve handling of empty trees.
  - Status view: fix reverting of unmerged files.
  - Fix regression for non-UTF-8 locales corrupting the view data.
  - Fix regression parsing multiple spaces in ~/.tigrc.
diff --git a/tig.c b/tig.c
index 27563e19670e252a8bf90b85416a30d8a15cdb12..cba101c7bc1e5e268ec51ddb901308484ce21f6b 100644 (file)
--- a/tig.c
+++ b/tig.c
@@ -3849,6 +3849,12 @@ tree_read_date(struct view *view, char *text, bool *read_date)
                };
                struct io io = {};
 
+               if (!view->lines) {
+                       tree_entry(view, LINE_TREE_PARENT, opt_path, NULL, NULL);
+                       report("Tree is empty");
+                       return TRUE;
+               }
+
                if (!run_io_rd(&io, log_file, FORMAT_NONE)) {
                        report("Failed to load tree data");
                        return TRUE;