From 43f84098b8dd9d86a86389b3909cb14e39c5cc74 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Fri, 15 Jun 2018 15:35:50 -0700 Subject: [PATCH] Fix crash on unexpected closing tag after error --- src/scanner.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scanner.cc b/src/scanner.cc index ad8dab7..8421e50 100644 --- a/src/scanner.cc +++ b/src/scanner.cc @@ -144,7 +144,7 @@ struct Scanner { if (is_closing_tag) { // The tag correctly closes the topmost element on the stack - if (next_tag == tags.back()) return false; + if (!tags.empty() && tags.back() == next_tag) return false; // Otherwise, dig deeper and queue implicit end tags (to be nice in // the case of malformed HTML)