Skip to content

Commit

Permalink
Check if block is nil to prevent panic (maticnetwork#736)
Browse files Browse the repository at this point in the history
  • Loading branch information
dkeysil authored and thogard785 committed Apr 5, 2023
1 parent a5871e0 commit 3d762e5
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions internal/ethapi/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3d762e5

Please sign in to comment.