vis
a vi-like editor based on Plan 9's structural regular expressions
git clone https://9o.is/git/vis.git
commit 16ea9f8f58c21ff8a3300b210ce4c6aa0a424c02 parent 2ff4842114b332d78d6bf08dac6c0ba73b9d9d2a Author: Marc André Tanner <mat@brain-dump.org> Date: Mon, 17 Jul 2017 23:00:26 +0200 vis: fix coverity issue 157025 The static analyzer can currently not infere that there always exists at least one selection. Diffstat:
| M | main.c | | | 6 | ++++-- |
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/main.c b/main.c @@ -1326,9 +1326,11 @@ static const char *selections_new(Vis *vis, const char *keys, const Arg *arg) { for (Selection *s = view_selections(view); s; s = view_selections_next(s)) sel = s; break; - default: - return keys; } + + if (!sel) + return keys; + size_t oldpos = view_cursors_pos(sel); if (arg->i > 0) view_line_down(sel);