Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix nil returned in Unmarshal functions #3806

Merged
merged 2 commits into from
Mar 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions PENDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,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