From: Bjørn Erik Pedersen Date: Sat, 27 Feb 2016 22:25:41 +0000 (+0100) Subject: Check for the presence of pages before setting dates X-Git-Tag: v0.16~304 X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=80460315;p=brevno-suite%2Fhugo Check for the presence of pages before setting dates See #1903 --- diff --git a/hugolib/site.go b/hugolib/site.go index acf8bb10..f3e14399 100644 --- a/hugolib/site.go +++ b/hugolib/site.go @@ -1711,8 +1711,10 @@ func (s *Site) newHomeNode() *Node { 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 }