aboutsummaryrefslogtreecommitdiffhomepage
path: root/source
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2019-03-25 18:18:34 +0100
committerBjørn Erik Pedersen <[email protected]>2019-03-26 10:20:40 +0100
commit4dae52af680e6ff2c8cdeb4ce1f219330b27001c (patch)
treedb157b09fc15b25a07512581fbd80536fe8e18ee /source
parent794d4052b87c98943588b35e1cfecc06e6a0c7f2 (diff)
downloadhugo-4dae52af680e6ff2c8cdeb4ce1f219330b27001c.tar.gz
hugo-4dae52af680e6ff2c8cdeb4ce1f219330b27001c.zip
Avoid nilpointer on no File on Page
Fixes #5781
Diffstat (limited to 'source')
-rw-r--r--source/fileInfo.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/source/fileInfo.go b/source/fileInfo.go
index 3f262fb5e..072b55b6c 100644
--- a/source/fileInfo.go
+++ b/source/fileInfo.go
@@ -53,6 +53,8 @@ type fileOverlap interface {
// Lang is the language code for this page. It will be the
// same as the site's language code.
Lang() string
+
+ IsZero() bool
}
type FileWithoutOverlap interface {
@@ -187,6 +189,10 @@ func (fi *FileInfo) Open() (hugio.ReadSeekCloser, error) {
return f, err
}
+func (fi *FileInfo) IsZero() bool {
+ return fi == nil
+}
+
// We create a lot of these FileInfo objects, but there are parts of it used only
// in some cases that is slightly expensive to construct.
func (fi *FileInfo) init() {