diff options
Diffstat (limited to 'src/blocks.c')
-rw-r--r-- | src/blocks.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/blocks.c b/src/blocks.c index 4acd899..777356a 100644 --- a/src/blocks.c +++ b/src/blocks.c @@ -561,10 +561,10 @@ S_process_line(cmark_parser *parser, const unsigned char *buffer, size_t bytes) // Add a newline to the end if not present: // TODO this breaks abstraction: - if (parser->curline->ptr[parser->curline->size - 1] == '\n') { + if (parser->curline->size && parser->curline->ptr[parser->curline->size - 1] == '\n') { cmark_strbuf_truncate(parser->curline, parser->curline->size - 1); } - if (parser->curline->ptr[parser->curline->size - 1] == '\r') { + if (parser->curline->size && parser->curline->ptr[parser->curline->size - 1] == '\r') { cmark_strbuf_truncate(parser->curline, parser->curline->size - 1); } cmark_strbuf_putc(parser->curline, '\n'); |