mirror of
https://github.com/yusing/godoxy.git
synced 2025-05-19 20:32:35 +02:00
fix: nil panic on unmarshaling zero value
This commit is contained in:
parent
7a5afc3612
commit
80e59bb481
1 changed files with 1 additions and 1 deletions
|
@ -314,7 +314,7 @@ func Convert(src reflect.Value, dst reflect.Value, checkValidateTag bool) gperr.
|
|||
return gperr.Errorf("convert: dst is %w", ErrNilValue)
|
||||
}
|
||||
|
||||
if !src.IsValid() {
|
||||
if !src.IsValid() || src.IsZero() {
|
||||
if dst.CanSet() {
|
||||
dst.Set(reflect.Zero(dst.Type()))
|
||||
return nil
|
||||
|
|
Loading…
Add table
Reference in a new issue