From 65e610e1617647a7dc6bb9f7794cfad068cb3615 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Thu, 19 Jul 2018 22:39:24 +0200 Subject: hugolib: Avoid nilpointer in absoluteSourceRef --- hugolib/page.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/hugolib/page.go b/hugolib/page.go index 838791ab8..f45257c9d 100644 --- a/hugolib/page.go +++ b/hugolib/page.go @@ -1883,9 +1883,11 @@ func (p *Page) FullFilePath() string { // For pages that do not (sections witout content page etc.), it returns the // virtual path, consistent with where you would add a source file. func (p *Page) absoluteSourceRef() string { - sourcePath := p.Source.Path() - if sourcePath != "" { - return "/" + filepath.ToSlash(sourcePath) + if p.Source.File != nil { + sourcePath := p.Source.Path() + if sourcePath != "" { + return "/" + filepath.ToSlash(sourcePath) + } } if len(p.sections) > 0 { -- cgit v1.2.3