Skip to content

Commit

Permalink
Fix nil pointer dereference in GetBinary (Fixes #264) (#265)
Browse files Browse the repository at this point in the history
* Fix nil pointer dereference in GetBinary (Fixes #264)

* fixed DataBytesOrJson nil check

---------

Co-authored-by: sina haseli <[email protected]>
  • Loading branch information
sina-haseli and sina haseli authored Dec 18, 2024
1 parent da21930 commit 1ec25d1
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions rpc/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,9 @@ func (wrap *DataBytesOrJSON) UnmarshalJSON(data []byte) error {
// GetBinary returns the decoded bytes if the encoding is
// "base58", "base64", or "base64+zstd".
func (dt *DataBytesOrJSON) GetBinary() []byte {
if dt == nil {
return nil
}
return dt.asDecodedBinary.Content
}

Expand Down

0 comments on commit 1ec25d1

Please sign in to comment.