Skip to content

Commit

Permalink
Fixed search crashing for some nested heading combinations (9.0.3 reg…
Browse files Browse the repository at this point in the history
…ression)
  • Loading branch information
squidfunk committed Jan 19, 2023
1 parent c31ef00 commit e7013e6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions material/plugins/search/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,11 +421,11 @@ def handle_endtag(self, tag):
# 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

Expand Down
8 changes: 4 additions & 4 deletions src/plugins/search/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,11 +421,11 @@ def handle_endtag(self, tag):
# 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

Expand Down

0 comments on commit e7013e6

Please sign in to comment.