Skip to content

Commit

Permalink
Merge PR #3806: Fix nil returned in Unmarshal functions
Browse files Browse the repository at this point in the history
* Fix nils returned in unmarshal functions
* Address comments
  • Loading branch information
jackzampolin authored and cwgoes committed Mar 6, 2019
1 parent dcc3357 commit 805e7fb
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions PENDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ CLI flag.
### Gaia

* [\#3777](https://github.com/cosmso/cosmos-sdk/pull/3777) `gaiad export` no longer panics when the database is empty
* [\#3806](https://github.com/cosmos/cosmos-sdk/pull/3806) Properly return errors from a couple of struct Unmarshal functions

### SDK

Expand Down
4 changes: 2 additions & 2 deletions types/address.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ func (va *ValAddress) UnmarshalJSON(data []byte) error {

err := json.Unmarshal(data, &s)
if err != nil {
return nil
return err
}

va2, err := ValAddressFromBech32(s)
Expand Down Expand Up @@ -415,7 +415,7 @@ func (ca *ConsAddress) UnmarshalJSON(data []byte) error {

err := json.Unmarshal(data, &s)
if err != nil {
return nil
return err
}

ca2, err := ConsAddressFromBech32(s)
Expand Down
2 changes: 1 addition & 1 deletion x/gov/depositsvotes.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ func (vo *VoteOption) UnmarshalJSON(data []byte) error {
var s string
err := json.Unmarshal(data, &s)
if err != nil {
return nil
return err
}

bz2, err := VoteOptionFromString(s)
Expand Down
4 changes: 2 additions & 2 deletions x/gov/proposals.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ func (pt *ProposalKind) UnmarshalJSON(data []byte) error {
var s string
err := json.Unmarshal(data, &s)
if err != nil {
return nil
return err
}

bz2, err := ProposalTypeFromString(s)
Expand Down Expand Up @@ -307,7 +307,7 @@ func (status *ProposalStatus) UnmarshalJSON(data []byte) error {
var s string
err := json.Unmarshal(data, &s)
if err != nil {
return nil
return err
}

bz2, err := ProposalStatusFromString(s)
Expand Down

0 comments on commit 805e7fb

Please sign in to comment.