Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'config/defaultConfigProvider.go')
-rw-r--r--config/defaultConfigProvider.go13
1 files changed, 12 insertions, 1 deletions
diff --git a/config/defaultConfigProvider.go b/config/defaultConfigProvider.go
index 80353664e..9f1c44ee1 100644
--- a/config/defaultConfigProvider.go
+++ b/config/defaultConfigProvider.go
@@ -169,6 +169,9 @@ func (c *defaultConfigProvider) Set(k string, v interface{}) {
}
key, m := c.getNestedKeyAndMap(k, true)
+ if m == nil {
+ return
+ }
if existing, found := m[key]; found {
if p1, ok := existing.(maps.Params); ok {
@@ -289,6 +292,9 @@ func (c *defaultConfigProvider) Merge(k string, v interface{}) {
}
key, m := c.getNestedKeyAndMap(k, true)
+ if m == nil {
+ return
+ }
if existing, found := m[key]; found {
if p1, ok := existing.(maps.Params); ok {
@@ -422,7 +428,12 @@ func (c *defaultConfigProvider) getNestedKeyAndMap(key string, create bool) (str
return "", nil
}
}
- current = next.(maps.Params)
+ var ok bool
+ current, ok = next.(maps.Params)
+ if !ok {
+ // E.g. a string, not a map that we can store values in.
+ return "", nil
+ }
}
return parts[len(parts)-1], current
}