shithub: hugo

Download patch

ref: 804603155f775bbf1b03dbeadbb78f978af6c169
parent: 75cf324322fafe9f2b3f92de369752f413886353
author: Bjørn Erik Pedersen <[email protected]>
date: Sat Feb 27 18:25:41 EST 2016

Check for the presence of pages before setting dates

See #1903

--- a/hugolib/site.go
+++ b/hugolib/site.go
@@ -1711,8 +1711,10 @@
 	n.IsHome = true
 	s.setURLs(n, "/")
 	n.Data["Pages"] = s.Pages
-	n.Date = s.Pages[0].Date
-	n.Lastmod = s.Pages[0].Lastmod
+	if len(s.Pages) != 0 {
+		n.Date = s.Pages[0].Date
+		n.Lastmod = s.Pages[0].Lastmod
+	}
 	return n
 }