Skip to content

Commit 2efe2bc

Browse files
author
Darioush Jalali
authored
trie, accounts/abi: nits: adds err checks (#583)
1 parent eec3cd5 commit 2efe2bc

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

accounts/abi/abi.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,10 @@ func UnpackRevert(data []byte) (string, error) {
365365
if !bytes.Equal(data[:4], revertSelector) {
366366
return "", errors.New("invalid data for unpacking")
367367
}
368-
typ, _ := NewType("string", "", nil)
368+
typ, err := NewType("string", "", nil)
369+
if err != nil {
370+
return "", err
371+
}
369372
unpacked, err := (Arguments{{Type: typ}}).Unpack(data[4:])
370373
if err != nil {
371374
return "", err

trie/stacktrie.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,9 @@ func (st *StackTrie) unmarshalBinary(r io.Reader) error {
151151
Val []byte
152152
Key []byte
153153
}
154-
gob.NewDecoder(r).Decode(&dec)
154+
if err := gob.NewDecoder(r).Decode(&dec); err != nil {
155+
return err
156+
}
155157
st.owner = dec.Owner
156158
st.nodeType = dec.NodeType
157159
st.val = dec.Val
@@ -165,7 +167,9 @@ func (st *StackTrie) unmarshalBinary(r io.Reader) error {
165167
continue
166168
}
167169
var child StackTrie
168-
child.unmarshalBinary(r)
170+
if err := child.unmarshalBinary(r); err != nil {
171+
return err
172+
}
169173
st.children[i] = &child
170174
}
171175
return nil

0 commit comments

Comments
 (0)