https://gitlab.synchro.net/main/sbbs/-/merge_requests/731#note_10312
Deuce: yes — here's a focused repro for #1183 / this MR.
**Original crash (production):** full-screen editor (`fseditor.js`) threw `TypeError: line[l + 1] is undefined` in `unwrap_line()` (reported on cvs.synchro.net, Node 12, user Cru Jones). Root cause in the issue: the unkludge path can `splice()` out `line[l+1]` mid-loop, then the "get first word(s) of next line" step still reads `line[l+1].text` with no re-check. Worst case is when that next line was the **last** line.
**Interactive repro (terminal):**
1. Enter message editor that uses `exec/fseditor.js` (full-screen editor).
2. 2. Type enough text that word-wrap creates a **kludged** wrap near the end (a long unbroken token/word that forces a mid-word wrap works well).
3. 3. Continue until the **final** wrapped fragment is short enough that an unwrap can pull all of it up into the previous line.
4. 4. Edit so unwrap runs on that kludged line (backspace/delete near the wrap boundary, or any edit that triggers `rewrap`/`unwrap_line`).
5. 5. Pre-fix: TypeError / node error referencing `unwrap_line` / `line[l + 1] is undefined`.
6. 6. Post-fix: editor stays up; last line is joined; no TypeError.
**Why this MR fixes it:** after the unkludge block we restore the loop invariant:
```
if(line[l+1]==undefined)
break;
```
before the second dereference. The obsolete TODO at the splice is removed.
Happy to adjust wording or add a tiny jsexec harness case if you want something more automated than the interactive path.
---
■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net