From 71831b3aab7063c3a13a381250109c0d372e269d Mon Sep 17 00:00:00 2001 From: Jonas Fonseca Date: Sun, 6 Oct 2013 17:16:17 -0400 Subject: [PATCH] Fix regression in add_line_at making line numbers start atf 0 instead of 1 This in turn caused the stash view to segfault when displaying IDs. --- tig.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tig.c b/tig.c index c3bb7f9..84ef1b8 100644 --- a/tig.c +++ b/tig.c @@ -3392,7 +3392,7 @@ static struct line * add_line_at(struct view *view, unsigned long pos, const void *data, enum line_type type, size_t data_size, bool custom) { struct line *line; - unsigned long lineno = view->lines - view->custom_lines; + unsigned long lineno; if (!realloc_lines(&view->line, view->lines, 1)) return NULL; @@ -3421,6 +3421,7 @@ add_line_at(struct view *view, unsigned long pos, const void *data, enum line_ty } } else { line = &view->line[view->lines++]; + lineno = view->lines - view->custom_lines; } memset(line, 0, sizeof(*line)); -- 2.11.4.GIT