mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-02-27 08:07:22 +00:00
Nil check block
This commit is contained in:
parent
499f816e30
commit
ece29c5d8d
1 changed files with 4 additions and 0 deletions
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Reference in a new issue