aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--form.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/form.c b/form.c
index da115fa..779ba2f 100644
--- a/form.c
+++ b/form.c
@@ -481,8 +481,8 @@ formUpdateBuffer(Anchor *a, Buffer *buf, FormItemList *form)
spos = a->start.pos;
epos = a->end.pos;
}
- if (a->start.line != a->end.line || spos > epos)
- epos = spos;
+ if (a->start.line != a->end.line || spos > epos || epos >= l->len)
+ break;
pos = form_update_line(l, &p, spos, epos, COLPOS(l, epos) - col,
rows > 1,
form->type == FORM_INPUT_PASSWORD);