diff options
author | Garry McNulty <garrmcnu@gmail.com> | 2018-07-15 14:35:41 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2018-07-15 16:13:48 +0200 |
commit | 38204c4ab6fa2aa2ab8bd06ddb3e07b66e5f9646 (patch) | |
tree | 70b712eea09df942d76952868a30b940e9547657 /hugolib/config.go | |
parent | 2f2bc7ff70b90fb11580cc092ef3883bf68d8ad7 (diff) |
hugolib: Only set 'allThemes' if there are themes in the config file
When the 'allThemes' configuration setting is read, it will panic if
there are no themes. This was a regression introduced in Hugo 0.42.
Also updated a unit test to check for this.
Fixes #4851
Diffstat (limited to 'hugolib/config.go')
-rw-r--r-- | hugolib/config.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/hugolib/config.go b/hugolib/config.go index 87f97f3a5..122bd3f1e 100644 --- a/hugolib/config.go +++ b/hugolib/config.go @@ -285,6 +285,11 @@ func loadThemeConfig(d ConfigSourceDescriptor, v1 *viper.Viper) ([]string, error if err != nil { return nil, err } + + if len(themeConfigs) == 0 { + return nil, nil + } + v1.Set("allThemes", themeConfigs) var configFilenames []string |