eth/api: fix potential nil deref in AccountRange (#21710)

* Fix potential nil pointer error when neither block number nor hash is specified to accountRange

* Update error description
# Conflicts:
#	eth/api.go
This commit is contained in:
aaronbuchwald 2020-10-20 14:19:21 -04:00 committed by Igor Mandrigin
parent 8b493c2895
commit 07aefb98c3

View File

@ -366,6 +366,7 @@ func (api *PublicDebugAPI) AccountRange(blockNrOrHash rpc.BlockNumberOrHash, sta
if block == nil { if block == nil {
return state.IteratorDump{}, fmt.Errorf("block %s not found", hash.Hex()) return state.IteratorDump{}, fmt.Errorf("block %s not found", hash.Hex())
} }
} else {
blockNumber = block.NumberU64() blockNumber = block.NumberU64()
} }