Merge PR #3806: Fix nil returned in Unmarshal functions

* Fix nils returned in unmarshal functions
* Address comments
This commit is contained in:
Jack Zampolin
2019-03-06 12:38:18 +01:00
committed by Christopher Goes
parent dcc3357ea3
commit 805e7fbfc2
4 changed files with 6 additions and 5 deletions
+1
View File
@@ -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
+2 -2
View File
@@ -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)
@@ -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)
+1 -1
View File
@@ -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)
+2 -2
View File
@@ -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)
@@ -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)