Prevent panic on empty authorlist

This commit is contained in:
Mathias Biilmann 2016-09-11 10:46:56 +02:00 committed by Bjørn Erik Pedersen
parent 3392133128
commit 7d3dfba84b

View file

@ -193,8 +193,11 @@ func (p *Page) Author() Author {
func (p *Page) Authors() AuthorList {
authorKeys, ok := p.Params["authors"]
if !ok {
return AuthorList{}
}
authors := authorKeys.([]string)
if !ok || len(authors) < 1 || len(p.Site.Authors) < 1 {
if len(authors) < 1 || len(p.Site.Authors) < 1 {
return AuthorList{}
}