summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2015-01-18 18:33:15 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2015-01-18 18:33:15 -0800
commit318aa82f73448275f4653b18e7d154782aa220c5 (patch)
tree64e50b8246bc4fbfcd97bf0ccc457dbc45869e89 /src
parent14b997d9350b3ee3f6d67fb12b470bf406d4a31b (diff)
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).
Diffstat (limited to 'src')
-rw-r--r--src/blocks.c7
1 files 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