aboutsummaryrefslogtreecommitdiffhomepage
path: root/langs
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2023-05-30 11:48:17 +0200
committerBjørn Erik Pedersen <[email protected]>2023-05-30 15:59:43 +0200
commit6462eecfbd7abc14fa62b33bb079ba424de7d765 (patch)
treedbcff5292acb8920c5d5a9f3bdf356bdf33a7c3a /langs
parenta7d6b1413f7dd7fdda30b12d577b90f4bb0487ff (diff)
downloadhugo-6462eecfbd7abc14fa62b33bb079ba424de7d765.tar.gz
hugo-6462eecfbd7abc14fa62b33bb079ba424de7d765.zip
Avoid panic in invalid language config
Fixes #11046
Diffstat (limited to 'langs')
-rw-r--r--langs/config.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/langs/config.go b/langs/config.go
index 15c0bedbc..f60ea94a4 100644
--- a/langs/config.go
+++ b/langs/config.go
@@ -14,6 +14,8 @@
package langs
import (
+ "errors"
+
"github.com/gohugoio/hugo/common/maps"
"github.com/mitchellh/mapstructure"
)
@@ -46,5 +48,8 @@ func DecodeConfig(m map[string]any) (map[string]LanguageConfig, error) {
if err := mapstructure.WeakDecode(m, &langs); err != nil {
return nil, err
}
+ if len(langs) == 0 {
+ return nil, errors.New("no languages configured")
+ }
return langs, nil
}