aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2018-02-28 15:08:15 +0100
committerThomas White <taw@physics.org>2018-03-03 17:56:12 +0100
commit2a80430b0e762e7ee3ccd0c8a620baf40fb30b12 (patch)
tree14a0d136e563449fd83dcd9542bea2b1bd3cb919
parent68894cb13edb3bea48bb37cb2846ee7cf558bfd0 (diff)
Add some warnings
-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) )
{