mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 23:26:44 +00:00
Check if block is nil to prevent panic (#736)
This commit is contained in:
parent
c4f33329ea
commit
0ed78b9261
1 changed files with 4 additions and 0 deletions
|
|
@ -628,6 +628,10 @@ func (s *PublicBlockChainAPI) GetTransactionReceiptsByBlock(ctx context.Context,
|
|||
return nil, err
|
||||
}
|
||||
|
||||
if block == nil {
|
||||
return nil, errors.New("block not found")
|
||||
}
|
||||
|
||||
receipts, err := s.b.GetReceipts(ctx, block.Hash())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
|||
Loading…
Reference in a new issue