mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-19 21:31:37 +00:00
graphql: handle nil block in Raw method
Add a nil check for the resolved block to prevent a panic when encoding a nil block to RLP bytes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
723aae2b4e
commit
23dca0cd78
1 changed files with 1 additions and 1 deletions
|
|
@ -929,7 +929,7 @@ func (b *Block) RawHeader(ctx context.Context) (hexutil.Bytes, error) {
|
|||
|
||||
func (b *Block) Raw(ctx context.Context) (hexutil.Bytes, error) {
|
||||
block, err := b.resolve(ctx)
|
||||
if err != nil {
|
||||
if err != nil || block == nil {
|
||||
return hexutil.Bytes{}, err
|
||||
}
|
||||
return rlp.EncodeToBytes(block)
|
||||
|
|
|
|||
Loading…
Reference in a new issue