vis

a vi-like editor based on Plan 9's structural regular expressions

git clone https://9o.is/git/vis.git

commit c4fe388da0e5b51a52bd5475b31aa0fab75fa0dd
parent ad23628ad92366be787c2a7f13659f9e5b3f90b4
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Sun,  5 Apr 2015 20:10:20 +0200

Fix clang static analyzer warnings

Diffstat:
Mui-curses.c | 2+-
Mwindow.c | 3++-
2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/ui-curses.c b/ui-curses.c @@ -194,7 +194,7 @@ static void ui_window_reload(UiWin *w, Text *text) { } static void ui_window_draw_sidebar(UiCursesWin *win, const Line *line) { - if (!win->winside) + if (!win->winside || !line) return; int sidebar_width = snprintf(NULL, 0, "%zd", line->lineno + win->height - 2) + 1; if (win->sidebar_width != sidebar_width) { diff --git a/window.c b/window.c @@ -448,7 +448,8 @@ bool window_resize(Win *win, int width, int height) { } win->width = width; win->height = height; - memset(win->lines, 0, win->lines_size); + if (win->lines) + memset(win->lines, 0, win->lines_size); window_draw(win); return true; }