Nil check block

pull/444/head
Taylor Gerring 10 years ago
parent 499f816e30
commit ece29c5d8d
  1. 4
      rpc/responses.go

@ -91,6 +91,10 @@ func (b *BlockRes) MarshalJSON() ([]byte, error) {
} }
func NewBlockRes(block *types.Block) *BlockRes { func NewBlockRes(block *types.Block) *BlockRes {
if block == nil {
return &BlockRes{}
}
res := new(BlockRes) res := new(BlockRes)
res.BlockNumber = block.Number().Int64() res.BlockNumber = block.Number().Int64()
res.BlockHash = block.Hash() res.BlockHash = block.Hash()

Loading…
Cancel
Save