aboutsummaryrefslogtreecommitdiff
path: root/src/sc_editor.c
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2016-03-14 22:24:15 +0100
committerThomas White <taw@bitwiz.org.uk>2016-03-14 22:24:15 +0100
commit66fa8fcaf035832193e7b4c0684a76d8e3e4071e (patch)
tree5c8d2a189eff3143e12e8b45ea6690b45decf46a /src/sc_editor.c
parentaed23b3e994f535715aa958e5fab43e84f23cef9 (diff)
cur_box_diag(): Avoid various edge cases
Diffstat (limited to 'src/sc_editor.c')
-rw-r--r--src/sc_editor.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/sc_editor.c b/src/sc_editor.c
index f205777..35a96c0 100644
--- a/src/sc_editor.c
+++ b/src/sc_editor.c
@@ -426,8 +426,21 @@ void cur_box_diag(SCEditor *e)
return;
}
+ if ( fr->lines[sln].boxes == NULL ) {
+ printf("line %i of %i, but it has no boxes\n",
+ sln, fr->n_lines);
+ return;
+ }
+
struct wrap_box *sbox = bv_box(fr->lines[sln].boxes, sbx);
+ if ( sbox == NULL ) {
+ printf("line/box: [%i of %i]/[%i of %i]/NULL box\n",
+ sln, fr->n_lines, sbx,
+ bv_len(e->cursor_frame->lines[sln].boxes));
+ return;
+ }
+
printf("line/box/pos: [%i of %i]/[%i of %i]/[%i of %i]\n",
sln, fr->n_lines, sbx, bv_len(e->cursor_frame->lines[sln].boxes),
sps, sbox->len_chars);