- Commit
- 8a3abfdb1c4dbe65b83b3df6b450a93a8a7eb170
- Parent
- 397829cbb945a1e3496552555e022ad4d5195851
- Author
- John MacFarlane <jgm@berkeley.edu>
- Date
Check for empty string before trying to look at line ending.
My personal build of CMark ✏️
Check for empty string before trying to look at line ending.
1 file changed, 1 insertion, 1 deletion
Status | File Name | N° Changes | Insertions | Deletions |
Modified | src/blocks.c | 2 | 1 | 1 |
diff --git 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;