shithub: hugo

Download patch

ref: 1ab4658c0d5ea2927f04bd748206e5b139a6326e
parent: 75acff5f20d0d41ffa1ae20402001c7a82f077cb
author: Bjørn Erik Pedersen <[email protected]>
date: Wed Jul 18 13:01:50 EDT 2018

hugolib: Fix potential server panic with drafts/future enabled

Fixes #4965

--- a/hugolib/site.go
+++ b/hugolib/site.go
@@ -1511,11 +1511,18 @@
 
 	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)
 	}
 }