hugolib: Fix potential server panic with drafts/future enabled

Fixes #4965
This commit is contained in:
Bjørn Erik Pedersen 2018-07-18 17:01:50 +02:00
parent 75acff5f20
commit 1ab4658c0d
No known key found for this signature in database
GPG key ID: 330E6E2BD4859D8F

View file

@ -1511,12 +1511,19 @@ func (s *Site) resetBuildState() {
spc = newPageCache()
for _, p := range s.rawAllPages {
initPage := func(p *Page) {
p.subSections = Pages{}
p.parent = nil
p.scratch = maps.NewScratch()
p.mainPageOutput = nil
}
for _, p := range s.Pages {
initPage(p)
}
for _, p := range s.headlessPages {
initPage(p)
}
}
func (s *Site) kindFromSections(sections []string) string {