aboutsummaryrefslogtreecommitdiff
path: root/vis.c
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2014-10-27 12:27:10 +0100
committerMarc André Tanner <mat@brain-dump.org>2014-10-27 12:27:10 +0100
commitab227e12694f7fea3c64d93d87e24f017fca65a5 (patch)
tree639d5cdc1aa831a5293769bf00142a19dc9013a2 /vis.c
parenta99e1540c389d6c716bfd5bb8c407831d5138651 (diff)
downloadvis-ab227e12694f7fea3c64d93d87e24f017fca65a5.tar.gz
vis-ab227e12694f7fea3c64d93d87e24f017fca65a5.tar.xz
Fix segfault when joining lines
Diffstat (limited to 'vis.c')
-rw-r--r--vis.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/vis.c b/vis.c
index f7053aa..4f6ccfb 100644
--- a/vis.c
+++ b/vis.c
@@ -650,7 +650,7 @@ static void op_join(OperatorContext *c) {
prev_pos = pos;
size_t end = text_line_start(txt, pos);
pos = text_char_next(txt, text_line_finish(txt, text_line_prev(txt, end)));
- if (pos > c->range.start) {
+ if (pos > c->range.start && end > pos) {
text_delete(txt, pos, end - pos);
text_insert(txt, pos, " ", 1);
} else {