From 3e82c9ef67b9948bc90ba244b9537054188ebaf8 Mon Sep 17 00:00:00 2001
From: aaronbuchwald <aaron.buchwald56@gmail.com>
Date: Tue, 20 Oct 2020 14:19:21 -0400
Subject: [PATCH] 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
---
 eth/api.go | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/eth/api.go b/eth/api.go
index 76118e2d7..fd3565647 100644
--- a/eth/api.go
+++ b/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 {
-- 
GitLab