aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2017-07-17 23:00:26 +0200
committerMarc André Tanner <mat@brain-dump.org>2017-07-17 23:00:26 +0200
commit75c7c61ecc4038340fa3acfab71ee19bbafa48a8 (patch)
tree6f9d61221a364fec36a138ea892e2083f776d740
parentb1d298556edd2f4bcb4e031c9fc6307cde79cca9 (diff)
downloadvis-75c7c61ecc4038340fa3acfab71ee19bbafa48a8.tar.gz
vis-75c7c61ecc4038340fa3acfab71ee19bbafa48a8.tar.xz
vis: fix coverity issue 157025
The static analyzer can currently not infere that there always exists at least one selection.
-rw-r--r--main.c6
1 files changed, 4 insertions, 2 deletions
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);