From b63b625096f59fc0bf9ea75ddf31380110790034 Mon Sep 17 00:00:00 2001 From: Jonas Fonseca Date: Tue, 3 Feb 2009 22:34:44 +0100 Subject: [PATCH] Tree view: improve handling of empty trees --- NEWS | 1 + tig.c | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/NEWS b/NEWS index 7f8e98e..733c98b 100644 --- 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 27563e1..cba101c 100644 --- 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; -- 2.32.0.93.g670b81a890