You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I encountered a runtime panic caused by a nil pointer dereference in the GetBinary method of the DataBytesOrJSON struct. The issue occurs when calling the GetTransaction() method on a TransactionWithMeta instance.
Steps to Reproduce
Use TransactionWithMeta.GetTransaction() in a context where the underlying asDecodedBinary field in DataBytesOrJSON is nil.
The GetBinary() method attempts to access asDecodedBinary.Content without checking if asDecodedBinary is nil.
This leads to a runtime panic:
Relevant Code
The panic occurs in this part of the GetBinary method:
I encountered a runtime panic caused by a
nil
pointer dereference in theGetBinary
method of theDataBytesOrJSON
struct. The issue occurs when calling theGetTransaction()
method on aTransactionWithMeta
instance.Steps to Reproduce
TransactionWithMeta.GetTransaction()
in a context where the underlyingasDecodedBinary
field inDataBytesOrJSON
isnil
.GetBinary()
method attempts to accessasDecodedBinary.Content
without checking ifasDecodedBinary
isnil
.Relevant Code
The panic occurs in this part of the
GetBinary
method:Add a
nil
check forasDecodedBinary
in theGetBinary
method to handle uninitialized or invalid states gracefully:Environment
solana-go version: v1.12.0
Go version: (go1.21)
Operating system: (Ubuntu 20.04)
Additional Context
Here’s an example of how this issue surfaces in code using solana-go:
The text was updated successfully, but these errors were encountered: