summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHugo Duncan <hugo@hugoduncan.org>2013-08-20 16:39:26 -0400
committerHugo Duncan <hugo@hugoduncan.org>2013-08-20 16:39:26 -0400
commit301d2bafcdb875281bdf7c8d2553ec4363a5f665 (patch)
treefd275883219f75d2015fe760e084c71306aa1949
parenteff8457ac91e337b81876271aca31bf4d61e09f1 (diff)
Print error if index value in a page is wrong type
This was causing a panic with no information displayed about the page causing the error.
-rw-r--r--hugolib/site.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/hugolib/site.go b/hugolib/site.go
index 517c82dc3..d6cd343cd 100644
--- a/hugolib/site.go
+++ b/hugolib/site.go
@@ -362,8 +362,13 @@ func (s *Site) BuildSiteMeta() (err error) {
vals := p.GetParam(plural)
if vals != nil {
- for _, idx := range vals.([]string) {
- s.Indexes[plural].Add(idx, s.Pages[i])
+ v, ok := vals.([]string)
+ if ok {
+ for _, idx := range v {
+ s.Indexes[plural].Add(idx, s.Pages[i])
+ }
+ } else {
+ PrintErr("Invalid " + plural + " in " + p.File.FileName)
}
}
}