From 78268fab8d2637f7b9f0a4266d711c1e4292b2be Mon Sep 17 00:00:00 2001 From: Thomas White Date: Sun, 13 Nov 2016 17:43:22 +0100 Subject: Fix crash --- src/frame.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/frame.c b/src/frame.c index d71df4e..9a09ea4 100644 --- a/src/frame.c +++ b/src/frame.c @@ -777,7 +777,13 @@ size_t pos_trail_to_offset(Paragraph *para, size_t offs, int trail) char *ptr; nrun = which_run(para, offs); - run= ¶->runs[nrun]; + run = ¶->runs[nrun]; + + if ( run == NULL ) { + fprintf(stderr, "pos_trail_to_offset: No run\n"); + return 0; + } + run_text = sc_block_contents(run->scblock) + run->scblock_offs_bytes; char_offs = g_utf8_pointer_to_offset(run_text, run_text+offs); char_offs += trail; -- cgit v1.2.3