From 75c7c61ecc4038340fa3acfab71ee19bbafa48a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Mon, 17 Jul 2017 23:00:26 +0200 Subject: vis: fix coverity issue 157025 The static analyzer can currently not infere that there always exists at least one selection. --- main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'main.c') diff --git a/main.c b/main.c index 0fd0489..ba4ae01 100644 --- 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); -- cgit v1.2.3