Commit 0ed69376576c3b6929bb467f566faf57bf3db1ca

Martin Mitas 2016-11-07T17:47:21

md_analyze_lt_gt: Fix assertion condition. The variable detected_end is valid only for 'is_raw_html' case.

diff --git a/md4c/md4c.c b/md4c/md4c.c
index 00492d0..2c14d63 100644
--- a/md4c/md4c.c
+++ b/md4c/md4c.c
@@ -1338,14 +1338,14 @@ md_analyze_lt_gt(MD_CTX* ctx, int mark_index, const MD_LINE* lines, int n_lines)
 
         /* Check whether the range forms a valid raw HTML. */
         if(is_autolink || is_raw_html) {
-            /* If this fails, it means we have missed some earlier opportunity
-             * to resolve the opener. */
-            MD_ASSERT(detected_end == mark->end);
-
             md_rollback(ctx, opener_index, mark_index, MD_ROLLBACK_ALL);
             md_resolve_range(ctx, &LOWERTHEN_OPENERS, opener_index, mark_index);
 
             if(is_raw_html) {
+                /* If this fails, it means we have missed some earlier opportunity
+                 * to resolve the opener of raw HTML. */
+                MD_ASSERT(detected_end == mark->end);
+
                 /* Make these marks zero width so the '<' and '>' are part of its
                  * contents. */
                 opener->end = opener->beg;