config: Fix a potential deadlock in config reading

Note that the deadlock has not been seen earlier, in tests on in real Hugo sites.

Fixes #8791
This commit is contained in:
Bjørn Erik Pedersen 2021-07-30 11:53:27 +02:00
parent 41c6c52ead
commit 94b616bdfa
No known key found for this signature in database
GPG key ID: 330E6E2BD4859D8F

View file

@ -89,6 +89,7 @@ func (c *defaultConfigProvider) Get(k string) interface{} {
c.mu.RLock()
key, m := c.getNestedKeyAndMap(strings.ToLower(k), false)
if m == nil {
c.mu.RUnlock()
return nil
}
v := m[key]