From 66fa8fcaf035832193e7b4c0684a76d8e3e4071e Mon Sep 17 00:00:00 2001 From: Thomas White Date: Mon, 14 Mar 2016 22:24:15 +0100 Subject: cur_box_diag(): Avoid various edge cases --- src/sc_editor.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src') 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); -- cgit v1.2.3