소스 검색

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
aaronbuchwald 5 년 전
부모
커밋
3e82c9ef67
1개의 변경된 파일2개의 추가작업 그리고 0개의 파일을 삭제
  1. 2 0
      eth/api.go

+ 2 - 0
eth/api.go

@@ -389,6 +389,8 @@ func (api *PublicDebugAPI) AccountRange(blockNrOrHash rpc.BlockNumberOrHash, sta
 		if err != nil {
 			return state.IteratorDump{}, err
 		}
+	} else {
+		return state.IteratorDump{}, errors.New("either block number or block hash must be specified")
 	}
 
 	if maxResults > AccountRangeMaxResults || maxResults <= 0 {