Skip to content

Commit

Permalink
Skip nil struct converting.
Browse files Browse the repository at this point in the history
  • Loading branch information
onrik committed Jul 11, 2019
1 parent f96e502 commit a50c0ba
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion magic.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func convert(from, to reflect.Value, converters ...Converter) error {
// Ptr to Type
if isPtrOf(from, to) {
if from.IsNil() {
from.Set(reflect.New(from.Type()).Elem())
return nil
}
return convert(from.Elem(), to.Elem(), converters...)
}
Expand Down

0 comments on commit a50c0ba

Please sign in to comment.