From cefa9c3b6561df0bd74ac501416dcf841c341faa Mon Sep 17 00:00:00 2001 From: =?utf8?q?Michael=20G=C3=B6hler?= Date: Fri, 19 Sep 2014 22:45:35 +0200 Subject: [PATCH] fixed segv if first line of file is HR, closes #27 --- parser.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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; -- 2.20.1