From 8a3abfdb1c4dbe65b83b3df6b450a93a8a7eb170 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sun, 9 Aug 2015 11:39:21 -0700 Subject: Check for empty string before trying to look at line ending. --- src/blocks.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/blocks.c') diff --git a/src/blocks.c b/src/blocks.c index 38450e0..6b2e14d 100755 --- a/src/blocks.c +++ b/src/blocks.c @@ -600,7 +600,7 @@ static void S_process_line(cmark_parser *parser, const unsigned char *buffer, cmark_strbuf_put(parser->curline, buffer, bytes); } // ensure line ends with a newline: - if (!S_is_line_end_char(parser->curline->ptr[bytes - 1])) { + if (bytes == 0 || !S_is_line_end_char(parser->curline->ptr[bytes - 1])) { cmark_strbuf_putc(parser->curline, '\n'); } parser->offset = 0; -- cgit v1.2.3