aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/frame.c3
-rw-r--r--src/sc_parse.c11
2 files changed, 9 insertions, 5 deletions
diff --git a/src/frame.c b/src/frame.c
index 5ada312..435fcc0 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -1377,7 +1377,8 @@ static SCBlock *split_text_paragraph(struct frame *fr, int pn, size_t pos,
para->n_runs = run+1;
/* If the first and second paragraphs have the same SCBlock, split it */
- if ( rr->scblock == pnew->runs[0].scblock ) {
+ if ( (rr->scblock != NULL) && (rr->scblock == pnew->runs[0].scblock) ) {
+
size_t sc_offs;
sc_offs = rr->scblock_offs_bytes + run_offs;
pnew->runs[0].scblock = sc_block_split(rr->scblock, sc_offs);
diff --git a/src/sc_parse.c b/src/sc_parse.c
index 4838bc6..3853800 100644
--- a/src/sc_parse.c
+++ b/src/sc_parse.c
@@ -786,10 +786,13 @@ SCBlock *sc_block_split(SCBlock *bl, size_t pos)
/* Second block */
n->name = s_strdup(bl->name);
n->options = s_strdup(bl->options);
- n->contents = strdup(bl->contents+pos);
-
- /* Truncate the first block */
- bl->contents[pos] = '\0';
+ if ( bl->contents != NULL ) {
+ n->contents = strdup(bl->contents+pos);
+ /* Truncate the first block */
+ bl->contents[pos] = '\0';
+ } else {
+ n->contents = NULL;
+ }
n->next = bl->next;
bl->next = n;