Don't write nil when saving blocks
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Peter Stuifzand 2020-10-28 20:19:38 +01:00
parent 93e10f5272
commit 3609b5020f

View File

@ -132,7 +132,7 @@ func NewFilePages(dirname string, index bleve.Index) PagesRepository {
} }
func convertBlocksToListItems(current string, blocks BlockResponse, indent int) []ActualListItem { func convertBlocksToListItems(current string, blocks BlockResponse, indent int) []ActualListItem {
var listItems []ActualListItem listItems := []ActualListItem{}
for _, child := range blocks.Children[current] { for _, child := range blocks.Children[current] {
l := convertBlocksToListItems(child, blocks, indent+1) l := convertBlocksToListItems(child, blocks, indent+1)
@ -350,7 +350,7 @@ func saveBlocksFromPage(dirname string, page Page) error {
prevList[parent.ID] = parent prevList[parent.ID] = parent
blocks[parent.ID] = Block{ blocks[parent.ID] = Block{
Text: title, Text: title,
Children: nil, Children: []string{},
Parent: root, Parent: root,
} }