Skip to content
Snippets Groups Projects
Commit e7013e66 authored by squidfunk's avatar squidfunk
Browse files

Fixed search crashing for some nested heading combinations (9.0.3 regression)

parent c31ef005
No related branches found
No related tags found
No related merge requests found
......@@ -421,11 +421,11 @@ class Parser(HTMLParser):
# which could also be a nested section – see https://bit.ly/3IxxIJZ
if self.section.depth > len(self.context):
for section in reversed(self.data):
if section.depth and section.depth <= len(self.context):
if section.depth <= len(self.context):
# Set depth to 0 in order to denote that the current section
# is exited and must not be considered again.
self.section.depth = 0
# Set depth to infinity in order to denote that the current
# section is exited and must never be considered again.
self.section.depth = float("inf")
self.section = section
break
......
......@@ -421,11 +421,11 @@ class Parser(HTMLParser):
# which could also be a nested section – see https://bit.ly/3IxxIJZ
if self.section.depth > len(self.context):
for section in reversed(self.data):
if section.depth and section.depth <= len(self.context):
if section.depth <= len(self.context):
# Set depth to 0 in order to denote that the current section
# is exited and must not be considered again.
self.section.depth = 0
# Set depth to infinity in order to denote that the current
# section is exited and must never be considered again.
self.section.depth = float("inf")
self.section = section
break
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment