diff options
author | Taylor Gerring <taylor.gerring@gmail.com> | 2015-04-02 20:54:28 +0800 |
---|---|---|
committer | Taylor Gerring <taylor.gerring@gmail.com> | 2015-04-02 20:54:28 +0800 |
commit | 876ce0fb12d7c1eae2907dad9ea13d01e9b3ac17 (patch) | |
tree | b1dda4e58f0c2fed203a8f7f313e5cd72fbfcb01 /rpc/api.go | |
parent | 172b34351aeb03d0318d241c0941c27608448cfb (diff) | |
download | go-tangerine-876ce0fb12d7c1eae2907dad9ea13d01e9b3ac17.tar.gz go-tangerine-876ce0fb12d7c1eae2907dad9ea13d01e9b3ac17.tar.zst go-tangerine-876ce0fb12d7c1eae2907dad9ea13d01e9b3ac17.zip |
More nil checks
Diffstat (limited to 'rpc/api.go')
-rw-r--r-- | rpc/api.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/rpc/api.go b/rpc/api.go index ee2a6a047..b46151cda 100644 --- a/rpc/api.go +++ b/rpc/api.go @@ -212,6 +212,9 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err block := api.xeth().EthBlockByHash(args.Hash) br := NewBlockRes(block, true) + if br == nil { + *reply = nil + } if args.Index >= int64(len(br.Transactions)) || args.Index < 0 { return NewValidationError("Index", "does not exist") @@ -225,6 +228,9 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err block := api.xeth().EthBlockByNumber(args.BlockNumber) v := NewBlockRes(block, true) + if v == nil { + *reply = nil + } if args.Index >= int64(len(v.Transactions)) || args.Index < 0 { return NewValidationError("Index", "does not exist") |