hugolib: Fix error handling for JSON front matter

Fixes #3610
This commit is contained in:
Bjørn Erik Pedersen 2017-06-19 14:41:03 +02:00
parent 662e12f348
commit fb53987a4f

View file

@ -1318,10 +1318,11 @@ func (p *Page) parse(reader io.Reader) error {
p.lang = p.Source.File.Lang()
meta, err := psr.Metadata()
if err != nil {
return fmt.Errorf("failed to parse page metadata for %q: %s", p.File.Path(), err)
}
if meta != nil {
if err != nil {
return fmt.Errorf("failed to parse page metadata for %s: %s", p.File.Path(), err)
}
if err = p.update(meta); err != nil {
return err
}