From 318aa82f73448275f4653b18e7d154782aa220c5 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sun, 18 Jan 2015 18:33:15 -0800 Subject: Readjust parser->current after closing fenced block. Added assertion to raise an error if finalize is called on a closed block (as was happening undetected because of the fallback behavior). --- src/blocks.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/blocks.c b/src/blocks.c index dafbb9b..806f7a6 100644 --- a/src/blocks.c +++ b/src/blocks.c @@ -192,10 +192,7 @@ finalize(cmark_parser *parser, cmark_node* b) parent = b->parent; - // don't do anything if the cmark_node is already closed - if (!b->open) - return parent; - + assert(b->open); // shouldn't call finalize on closed blocks b->open = false; if (parser->curline->size == 0) { @@ -605,7 +602,7 @@ S_process_line(cmark_parser *parser, const unsigned char *buffer, size_t bytes) // the end of a line, we can return: all_matched = false; offset += matched; - finalize(parser, container); + parser->current = finalize(parser, container); goto finished; } else { // skip opt. spaces of fence offset -- cgit v1.2.3