diff options
author | John MacFarlane <jgm@berkeley.edu> | 2015-08-09 11:39:21 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2015-08-09 11:39:21 -0700 |
commit | 8a3abfdb1c4dbe65b83b3df6b450a93a8a7eb170 (patch) | |
tree | 25bf22b264aa90cac0a7291366b2da008d30552b /src | |
parent | 397829cbb945a1e3496552555e022ad4d5195851 (diff) |
Check for empty string before trying to look at line ending.
Diffstat (limited to 'src')
-rwxr-xr-x | src/blocks.c | 2 |
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; |