From: Michael Göhler Date: Fri, 19 Sep 2014 20:45:35 +0000 (+0200) Subject: fixed segv if first line of file is HR, closes #27 X-Git-Url: https://git.danieliu.xyz/?a=commitdiff_plain;h=cefa9c3b6561df0bd74ac501416dcf841c341faa;p=smdp.git fixed segv if first line of file is HR, closes #27 --- diff --git a/parser.c b/parser.c index 8489ab0..1ff125c 100644 --- a/parser.c +++ b/parser.c @@ -53,9 +53,15 @@ deck_t *markdown_load(FILE *input) { // markdown analyse bits = markdown_analyse(text); + // if first line in file is markdown hr + if(!line && CHECK_BIT(bits, IS_HR)) { + + // clear text + (text->reset)(text); + // if text is markdown hr - if(CHECK_BIT(bits, IS_HR) && - CHECK_BIT(line->bits, IS_EMPTY)) { + } else if(CHECK_BIT(bits, IS_HR) && + CHECK_BIT(line->bits, IS_EMPTY)) { slide->lines = lc;