diff options
author | Thomas White <taw@bitwiz.org.uk> | 2016-11-13 17:43:22 +0100 |
---|---|---|
committer | Thomas White <taw@bitwiz.org.uk> | 2016-11-13 17:43:22 +0100 |
commit | 78268fab8d2637f7b9f0a4266d711c1e4292b2be (patch) | |
tree | f7a90df856e9b2e30fcd2fd9d53d5f2f8fd1c60b | |
parent | e3189e041b278cc778197dcca174d18ecc67faf0 (diff) |
Fix crash
-rw-r--r-- | src/frame.c | 8 |
1 files changed, 7 insertions, 1 deletions
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; |