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:
Evgeniy Stratonikov 2021-03-05 18:09:05 +03:00
parent e551432b30
commit 5a3fa47b95

View file

@ -19,6 +19,9 @@ func FromBytes(data []byte) *big.Int {
n := new(big.Int)
size := len(data)
if size == 0 {
if data == nil {
panic("nil slice provided to `FromBytes`")
}
return big.NewInt(0)
}