aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/cmd/acme/text.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/cmd/acme/text.c b/src/cmd/acme/text.c
index 463db9ff..c537d277 100644
--- a/src/cmd/acme/text.c
+++ b/src/cmd/acme/text.c
@@ -725,6 +725,10 @@ texttype(Text *t, Rune r)
case Kend:
typecommit(t);
if(t->iq1 > t->org+t->fr.nchars) {
+ if(t->iq1 > t->file->b.nc) {
+ // should not happen, but does. and it will crash textbacknl.
+ t->iq1 = t->file->b.nc;
+ }
q0 = textbacknl(t, t->iq1, 1);
textsetorigin(t, q0, TRUE);
} else