Skip to content

Commit

Permalink
Check if block is nil to prevent panic (#736)
Browse files Browse the repository at this point in the history
  • Loading branch information
dkeysil authored and manav2401 committed Feb 13, 2023
1 parent 22fa403 commit 77288f1
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 @@ -631,6 +631,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 77288f1

Please sign in to comment.