summaryrefslogtreecommitdiff
path: root/src/blocks.c
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2015-08-09 11:39:21 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2015-08-09 11:39:21 -0700
commit8a3abfdb1c4dbe65b83b3df6b450a93a8a7eb170 (patch)
tree25bf22b264aa90cac0a7291366b2da008d30552b /src/blocks.c
parent397829cbb945a1e3496552555e022ad4d5195851 (diff)
Check for empty string before trying to look at line ending.
Diffstat (limited to 'src/blocks.c')
-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;