Verify that parents isn't empty before popping

If the first iteration of the loop isn't a match then parents will be an
empty list.
This commit is contained in:
Dougal Matthews
2014-10-08 07:58:56 +01:00
parent 7c66b5bc71
commit f2bee586bb

View File

@@ -95,7 +95,8 @@ def _parse_html_table_of_contents(html):
if line.endswith('<ul>'):
parents.append(nav)
elif line.startswith('</ul>'):
parents.pop()
if parents:
parents.pop()
# For the table of contents, always mark the first element as active
if ret: