graphql: add nil check in Transaction.Type() method (#33184)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run

Add nil check before calling tx.Type() to prevent panic when transaction
is not found.
This commit is contained in:
oooLowNeoNooo 2025-11-14 08:16:03 +01:00 committed by GitHub
parent 488d987fc4
commit aa36bcd0aa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -575,6 +575,9 @@ func (t *Transaction) getLogs(ctx context.Context, hash common.Hash) (*[]*Log, e
func (t *Transaction) Type(ctx context.Context) *hexutil.Uint64 {
tx, _ := t.resolve(ctx)
if tx == nil {
return nil
}
txType := hexutil.Uint64(tx.Type())
return &txType
}