From ece29c5d8da2a8477ec2a95c8d0307a55ab21b76 Mon Sep 17 00:00:00 2001 From: Taylor Gerring Date: Tue, 10 Mar 2015 19:34:07 -0500 Subject: Nil check block --- rpc/responses.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'rpc') 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() -- cgit v1.2.3