Skip to content

Commit

Permalink
fix possible nil pointer panic (#206)
Browse files Browse the repository at this point in the history
Co-authored-by: lmittmann <[email protected]>
  • Loading branch information
lmittmann and lmittmann authored Jan 9, 2025
1 parent 9e1e566 commit 788439c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion w3vm/fetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,9 @@ func (f *rpcFetcher) storeTestdataState(tb testing.TB, chainID uint64) error {
continue
}

if s.Accounts[storageKey.addr].Storage == nil {
if acc, ok := s.Accounts[storageKey.addr]; !ok {
s.Accounts[storageKey.addr] = &account{Storage: map[w3hexutil.Hash]w3hexutil.Hash{}}
} else if acc.Storage == nil {
s.Accounts[storageKey.addr].Storage = make(map[w3hexutil.Hash]w3hexutil.Hash)
}
s.Accounts[storageKey.addr].Storage[w3hexutil.Hash(storageKey.slot)] = w3hexutil.Hash(storageVal)
Expand Down

0 comments on commit 788439c

Please sign in to comment.