From 8db857ca17a5e4d9d1b37f7ca18f6f2b720be894 Mon Sep 17 00:00:00 2001 From: Shu cheng <34236969+ChengShusss@users.noreply.github.com> Date: Sun, 29 Oct 2023 19:04:07 +0800 Subject: [PATCH] fix: misplaced subsection position in toc.ncx (#13) fix: misplaced subsection position in toc.ncx (#12) Co-authored-by: ChengShusss --- toc.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toc.go b/toc.go index d5566b5..56b62b8 100644 --- a/toc.go +++ b/toc.go @@ -214,7 +214,7 @@ func (t *toc) addSubSection(parent string, index int, title string, relativePath }, Children: nil, } - if parentNcxIndex > len(t.ncxXML.NavMap) { + if len(t.ncxXML.NavMap) > parentNcxIndex { if t.ncxXML.NavMap[parentNcxIndex].Children == nil { n := make([]tocNcxNavPoint, 0) t.ncxXML.NavMap[parentNcxIndex].Children = &n