mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-23 13:41:37 +00:00
encoding: panic on nil slice
After `state.StorageItem` became a slice of bytes we no longer panic on accessing `si.Value`. This helps to ensure that nothing was broken. Providing `nil` to `FromBytes` is probably an error anyway.
This commit is contained in:
parent
e551432b30
commit
5a3fa47b95
1 changed files with 3 additions and 0 deletions
|
@ -19,6 +19,9 @@ func FromBytes(data []byte) *big.Int {
|
||||||
n := new(big.Int)
|
n := new(big.Int)
|
||||||
size := len(data)
|
size := len(data)
|
||||||
if size == 0 {
|
if size == 0 {
|
||||||
|
if data == nil {
|
||||||
|
panic("nil slice provided to `FromBytes`")
|
||||||
|
}
|
||||||
return big.NewInt(0)
|
return big.NewInt(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue