mirror of
https://github.com/yusing/godoxy.git
synced 2026-03-22 00:59:11 +01:00
fix: nil panic on unmarshaling zero value
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user