diff options
author | Thomas White <taw@bitwiz.me.uk> | 2019-10-10 20:33:59 +0200 |
---|---|---|
committer | Thomas White <taw@bitwiz.me.uk> | 2019-10-10 20:33:59 +0200 |
commit | 0243f814940b6f2a02664b5a19ef21e636e2af2e (patch) | |
tree | 4a84fe8c149169e0f5d6808d9753c52b54916e32 /libstorycode/storycode.y | |
parent | 1659e38235bd4fef10adede67ba070eb217f67b1 (diff) |
Keep 'run' out of struct slide_pos
Diffstat (limited to 'libstorycode/storycode.y')
-rw-r--r-- | libstorycode/storycode.y | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/libstorycode/storycode.y b/libstorycode/storycode.y index 587db4a..f3c2653 100644 --- a/libstorycode/storycode.y +++ b/libstorycode/storycode.y @@ -268,10 +268,18 @@ struct text_run **combine_paras(struct parse_many_paragraphs mp, int **pn_runs) combined_paras = malloc(mp.n_paras * sizeof(struct text_run *)); n_runs = malloc(mp.n_paras * sizeof(int)); for ( i=0; i<mp.n_paras; i++ ) { - for ( int j=0; j<mp.paras[i].n_runs; j++ ) { + if ( mp.paras[i].n_runs > 0 ) { + combined_paras[i] = mp.paras[i].runs; + n_runs[i] = mp.paras[i].n_runs; + } else { + /* Create a single dummy run */ + struct text_run *run; + run = malloc(sizeof(struct text_run)); + run->text = strdup(""); + run->type = TEXT_RUN_NORMAL; + combined_paras[i] = run; + n_runs[i] = 1; } - combined_paras[i] = mp.paras[i].runs; - n_runs[i] = mp.paras[i].n_runs; } *pn_runs = n_runs; |