mirror of
https://github.com/spf13/viper
synced 2024-12-23 03:57:01 +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 source != nil {
|
||||||
if reflect.TypeOf(source).Kind() == reflect.Map {
|
if reflect.TypeOf(source).Kind() == reflect.Map {
|
||||||
val := v.searchMap(cast.ToStringMap(source), path[1:])
|
val := v.searchMap(cast.ToStringMap(source), path[1:])
|
||||||
jww.TRACE.Println(key, "found in nested config:", val)
|
if val != nil {
|
||||||
return val
|
jww.TRACE.Println(key, "found in nested config:", val)
|
||||||
|
return val
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue