From 3609b5020f6417bdacba41747051c5019f9dbf3c Mon Sep 17 00:00:00 2001 From: Peter Stuifzand Date: Wed, 28 Oct 2020 20:19:38 +0100 Subject: [PATCH] Don't write nil when saving blocks --- file.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/file.go b/file.go index b0ef526..ba92701 100644 --- a/file.go +++ b/file.go @@ -132,7 +132,7 @@ func NewFilePages(dirname string, index bleve.Index) PagesRepository { } func convertBlocksToListItems(current string, blocks BlockResponse, indent int) []ActualListItem { - var listItems []ActualListItem + listItems := []ActualListItem{} for _, child := range blocks.Children[current] { l := convertBlocksToListItems(child, blocks, indent+1) @@ -350,7 +350,7 @@ func saveBlocksFromPage(dirname string, page Page) error { prevList[parent.ID] = parent blocks[parent.ID] = Block{ Text: title, - Children: nil, + Children: []string{}, Parent: root, }