diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2019-03-25 18:18:34 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2019-03-26 10:20:40 +0100 |
commit | 4dae52af680e6ff2c8cdeb4ce1f219330b27001c (patch) | |
tree | db157b09fc15b25a07512581fbd80536fe8e18ee /hugolib/site.go | |
parent | 794d4052b87c98943588b35e1cfecc06e6a0c7f2 (diff) |
Avoid nilpointer on no File on Page
Fixes #5781
Diffstat (limited to 'hugolib/site.go')
-rw-r--r-- | hugolib/site.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/hugolib/site.go b/hugolib/site.go index 145ae2d49..1bf2d639c 100644 --- a/hugolib/site.go +++ b/hugolib/site.go @@ -789,11 +789,11 @@ func (s *siteRefLinker) refLink(ref string, source interface{}, relative bool, o if refURL.Fragment != "" { _ = target link = link + "#" + refURL.Fragment - if pctx, ok := target.(pageContext); ok && target.File() != nil && !pctx.getRenderingConfig().PlainIDAnchors { + if pctx, ok := target.(pageContext); ok && !target.File().IsZero() && !pctx.getRenderingConfig().PlainIDAnchors { if refURL.Path != "" { link = link + ":" + target.File().UniqueID() } - } else if pctx, ok := p.(pageContext); ok && p.File() != nil && !pctx.getRenderingConfig().PlainIDAnchors { + } else if pctx, ok := p.(pageContext); ok && !p.File().IsZero() && !pctx.getRenderingConfig().PlainIDAnchors { link = link + ":" + p.File().UniqueID() } |