aboutsummaryrefslogtreecommitdiff
path: root/src/frame.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/frame.c')
-rw-r--r--src/frame.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/frame.c b/src/frame.c
index dbe392d..fc2fefc 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -928,6 +928,12 @@ size_t pos_trail_to_offset(Paragraph *para, size_t offs, int trail)
char *ptr;
nrun = which_run(para, offs);
+
+ if ( nrun == para->n_runs ) {
+ fprintf(stderr, "pos_trail_to_offset: Offset too high\n");
+ return 0;
+ }
+
run = &para->runs[nrun];
if ( para->type != PARA_TYPE_TEXT ) return 0;
@@ -937,6 +943,11 @@ size_t pos_trail_to_offset(Paragraph *para, size_t offs, int trail)
return 0;
}
+ if ( run->scblock == NULL ) {
+ fprintf(stderr, "pos_trail_to_offset: SCBlock = NULL?\n");
+ return 0;
+ }
+
if ( (sc_block_name(run->scblock) != NULL)
&& (strcmp(sc_block_name(run->scblock), "newpara") == 0) )
{