mirror of
https://github.com/spf13/viper
synced 2024-12-23 12:07:02 +00:00
Prevent shadowning of keys when a nested key's value is nil.
This commit is contained in:
parent
a212099cbe
commit
7d1565ac32
1 changed files with 4 additions and 2 deletions
6
viper.go
6
viper.go
|
@ -757,8 +757,10 @@ func (v *Viper) find(key string) interface{} {
|
|||
if source != nil {
|
||||
if reflect.TypeOf(source).Kind() == reflect.Map {
|
||||
val := v.searchMap(cast.ToStringMap(source), path[1:])
|
||||
jww.TRACE.Println(key, "found in nested config:", val)
|
||||
return val
|
||||
if val != nil {
|
||||
jww.TRACE.Println(key, "found in nested config:", val)
|
||||
return val
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue