Prevent shadowning of keys when a nested key's value is nil.

This commit is contained in:
Laszlo Kiss 2016-01-23 22:17:01 -07:00
parent a212099cbe
commit 7d1565ac32

View file

@ -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
}
}
}
}