mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
accounts/abi: added dst.CanSet checks
This commit is contained in:
parent
3f6a41a22d
commit
1df389d5f7
1 changed files with 11 additions and 4 deletions
|
|
@ -17,6 +17,7 @@
|
||||||
package abi
|
package abi
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"math/big"
|
"math/big"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
|
@ -110,8 +111,11 @@ func setSlice(dst, src reflect.Value) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dst.Set(slice)
|
if dst.CanSet() {
|
||||||
return nil
|
dst.Set(slice)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return errors.New("Cannot set slice, destination not settable")
|
||||||
}
|
}
|
||||||
|
|
||||||
func setArray(dst, src reflect.Value) error {
|
func setArray(dst, src reflect.Value) error {
|
||||||
|
|
@ -125,8 +129,11 @@ func setArray(dst, src reflect.Value) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dst.Set(array)
|
if dst.CanSet() {
|
||||||
return nil
|
dst.Set(array)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return errors.New("Cannot set array, destination not settable")
|
||||||
}
|
}
|
||||||
|
|
||||||
func setStruct(dst, src reflect.Value) error {
|
func setStruct(dst, src reflect.Value) error {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue