Skip to content

Commit

Permalink
fix: panic when Decode's input is array and output is a slice
Browse files Browse the repository at this point in the history
  • Loading branch information
suzuki-shunsuke committed Dec 23, 2021
1 parent 74cdd45 commit ab94595
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mapstructure.go
Expand Up @@ -1088,7 +1088,7 @@ func (d *Decoder) decodeSlice(name string, data interface{}, val reflect.Value)
}

// If the input value is nil, then don't allocate since empty != nil
if dataVal.IsNil() {
if dataValKind != reflect.Array && dataVal.IsNil() {
return nil
}

Expand Down

0 comments on commit ab94595

Please sign in to comment.