mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-26 06:36:43 +00:00
accounts/abi: Must copy arrays of arrays element wise
This commit is contained in:
parent
f3228592f5
commit
ac7a2658c4
1 changed files with 8 additions and 1 deletions
|
|
@ -81,7 +81,14 @@ func set(dst, src reflect.Value, output Argument) error {
|
||||||
if dst.Len() < output.Type.SliceSize {
|
if dst.Len() < output.Type.SliceSize {
|
||||||
return fmt.Errorf("abi: cannot unmarshal src (len=%d) in to dst (len=%d)", output.Type.SliceSize, dst.Len())
|
return fmt.Errorf("abi: cannot unmarshal src (len=%d) in to dst (len=%d)", output.Type.SliceSize, dst.Len())
|
||||||
}
|
}
|
||||||
|
switch dstType.Elem().Kind() {
|
||||||
|
case reflect.Array:
|
||||||
|
for i := 0; i < dst.Len(); i++ {
|
||||||
|
reflect.Copy(dst.Index(i), src.Index(i))
|
||||||
|
}
|
||||||
|
default:
|
||||||
reflect.Copy(dst, src)
|
reflect.Copy(dst, src)
|
||||||
|
}
|
||||||
case dstType.Kind() == reflect.Interface:
|
case dstType.Kind() == reflect.Interface:
|
||||||
dst.Set(src)
|
dst.Set(src)
|
||||||
case dstType.Kind() == reflect.Ptr:
|
case dstType.Kind() == reflect.Ptr:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue