summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsrc/blocks.c2
1 files changed, 1 insertions, 1 deletions
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;