aboutsummaryrefslogtreecommitdiffstats
path: root/rpc/responses.go
diff options
context:
space:
mode:
authorTaylor Gerring <taylor.gerring@gmail.com>2015-03-11 08:34:07 +0800
committerTaylor Gerring <taylor.gerring@gmail.com>2015-03-11 08:34:07 +0800
commitece29c5d8da2a8477ec2a95c8d0307a55ab21b76 (patch)
tree381f3c75e951d4733de93cf255205ab72a665e53 /rpc/responses.go
parent499f816e3034c3e781f8ad35da070c9989cf6e3c (diff)
downloaddexon-ece29c5d8da2a8477ec2a95c8d0307a55ab21b76.tar.gz
dexon-ece29c5d8da2a8477ec2a95c8d0307a55ab21b76.tar.zst
dexon-ece29c5d8da2a8477ec2a95c8d0307a55ab21b76.zip
Nil check block
Diffstat (limited to 'rpc/responses.go')
-rw-r--r--rpc/responses.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/rpc/responses.go b/rpc/responses.go
index f5db285e1..20b13f6e2 100644
--- a/rpc/responses.go
+++ b/rpc/responses.go
@@ -91,6 +91,10 @@ func (b *BlockRes) MarshalJSON() ([]byte, error) {
}
func NewBlockRes(block *types.Block) *BlockRes {
+ if block == nil {
+ return &BlockRes{}
+ }
+
res := new(BlockRes)
res.BlockNumber = block.Number().Int64()
res.BlockHash = block.Hash()