shithub: hugo

Download patch

ref: 65e610e1617647a7dc6bb9f7794cfad068cb3615
parent: b56d9a1294e692d096bff442e0b1fec61a8c2b0f
author: Bjørn Erik Pedersen <[email protected]>
date: Thu Jul 19 18:39:24 EDT 2018

hugolib: Avoid nilpointer in absoluteSourceRef

--- a/hugolib/page.go
+++ b/hugolib/page.go
@@ -1883,9 +1883,11 @@
 // 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 {