🐛 Fix: active index of toc may result in error

fix #305
This commit is contained in:
Cell
2023-11-26 11:21:29 +08:00
parent 6f16b3ffe1
commit 8cfd7d30a4
3 changed files with 3 additions and 3 deletions
+1 -1
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -675,7 +675,7 @@ class FixIt {
break;
}
}
if (activeTocIndex !== -1) {
if (activeTocIndex !== -1 && $tocLinkElements[activeTocIndex]) {
$tocLinkElements[activeTocIndex].classList.add('active');
let $parent = $tocLinkElements[activeTocIndex].parentElement;
while ($parent !== $tocCore) {