From f2bee586bbc474f553fa3fc5b98449d698051df5 Mon Sep 17 00:00:00 2001 From: Dougal Matthews Date: Wed, 8 Oct 2014 07:58:56 +0100 Subject: [PATCH] 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. --- mkdocs/toc.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mkdocs/toc.py b/mkdocs/toc.py index 563cb98d..ffae6570 100644 --- a/mkdocs/toc.py +++ b/mkdocs/toc.py @@ -95,7 +95,8 @@ def _parse_html_table_of_contents(html): if line.endswith(''): - parents.pop() + if parents: + parents.pop() # For the table of contents, always mark the first element as active if ret: