diff --git a/src/html/htmlparser.cpp b/src/html/htmlparser.cpp
index e5d3b66..e35f181 100644
--- a/src/html/htmlparser.cpp
+++ b/src/html/htmlparser.cpp
@@ -1894,7 +1894,7 @@ void HTMLParser::CheckClosingTags()
// on the stack we have only opening tags
// but only the last tag is a closing tag
- if( stack_len < 3 )
+ if( stack_len == 1 )
{
PopStack();
return;