aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2016-11-13 17:43:22 +0100
committerThomas White <taw@bitwiz.org.uk>2016-11-13 17:43:22 +0100
commit78268fab8d2637f7b9f0a4266d711c1e4292b2be (patch)
treef7a90df856e9b2e30fcd2fd9d53d5f2f8fd1c60b /src
parente3189e041b278cc778197dcca174d18ecc67faf0 (diff)
Fix crash
Diffstat (limited to 'src')
-rw-r--r--src/frame.c8
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= &para->runs[nrun];
+ run = &para->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;