diff options
author | Bjørn Erik Pedersen <[email protected]> | 2019-03-25 18:18:34 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2019-03-26 10:20:40 +0100 |
commit | 4dae52af680e6ff2c8cdeb4ce1f219330b27001c (patch) | |
tree | db157b09fc15b25a07512581fbd80536fe8e18ee /source/fileInfo.go | |
parent | 794d4052b87c98943588b35e1cfecc06e6a0c7f2 (diff) | |
download | hugo-4dae52af680e6ff2c8cdeb4ce1f219330b27001c.tar.gz hugo-4dae52af680e6ff2c8cdeb4ce1f219330b27001c.zip |
Avoid nilpointer on no File on Page
Fixes #5781
Diffstat (limited to 'source/fileInfo.go')
-rw-r--r-- | source/fileInfo.go | 6 |
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() { |