Skip to content

Commit

Permalink
Avoid decoding nil pointer in map walker
Browse files Browse the repository at this point in the history
  • Loading branch information
kyhavlov committed Apr 18, 2023
1 parent 46212cc commit 4c10c53
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/map_walker.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func (w *mapWalker) MapElem(m, k, v reflect.Value) error {
return nil
}

if inner := v.Elem(); inner.Type() == typMapIfaceIface {
if inner := v.Elem(); inner.IsValid() && inner.Type() == typMapIfaceIface {
// map[interface{}]interface{}, attempt to weakly decode into string keys
var target map[string]interface{}
if err := mapstructure.WeakDecode(v.Interface(), &target); err != nil {
Expand Down

0 comments on commit 4c10c53

Please sign in to comment.