From 21bb0bc95d0450ddd3b2009a779df3e166a91414 Mon Sep 17 00:00:00 2001 From: bjt-user Date: Sun, 5 May 2024 23:14:51 +0200 Subject: [PATCH] fixed bug in get_child_indices function --- tree.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tree.go b/tree.go index e71505e..1855082 100644 --- a/tree.go +++ b/tree.go @@ -37,6 +37,10 @@ func get_child_indices(header_index int, headings []heading) []int { parent_level := get_heading_level(headings[header_index].text) + if header_index >= (len(headings) - 1) { + return nil + } + next_level := get_heading_level(headings[header_index+1].text) child_level := 0