aboutsummaryrefslogtreecommitdiffhomepage
path: root/deps
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 /deps
parent794d4052b87c98943588b35e1cfecc06e6a0c7f2 (diff)
downloadhugo-4dae52af680e6ff2c8cdeb4ce1f219330b27001c.tar.gz
hugo-4dae52af680e6ff2c8cdeb4ce1f219330b27001c.zip
Avoid nilpointer on no File on Page
Fixes #5781
Diffstat (limited to 'deps')
-rw-r--r--deps/deps.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/deps/deps.go b/deps/deps.go
index 47159d017..fa62fe5ae 100644
--- a/deps/deps.go
+++ b/deps/deps.go
@@ -34,6 +34,9 @@ type Deps struct {
// Used to log errors that may repeat itself many times.
DistinctErrorLog *helpers.DistinctLogger
+ // Used to log warnings that may repeat itself many times.
+ DistinctWarningLog *helpers.DistinctLogger
+
// The templates to use. This will usually implement the full tpl.TemplateHandler.
Tmpl tpl.TemplateFinder `json:"-"`
@@ -233,11 +236,13 @@ func New(cfg DepsCfg) (*Deps, error) {
}
distinctErrorLogger := helpers.NewDistinctLogger(logger.ERROR)
+ distinctWarnLogger := helpers.NewDistinctLogger(logger.WARN)
d := &Deps{
Fs: fs,
Log: logger,
DistinctErrorLog: distinctErrorLogger,
+ DistinctWarningLog: distinctWarnLogger,
templateProvider: cfg.TemplateProvider,
translationProvider: cfg.TranslationProvider,
WithTemplate: cfg.WithTemplate,