Support json encode/decode for nil values in S structs

This commit is contained in:
Ethan Frey
2017-02-23 18:11:20 +01:00
parent b6a2c5949f
commit 8c9b889ccf
4 changed files with 27 additions and 3 deletions

View File

@ -45,7 +45,7 @@ func (p SignatureS) MarshalJSON() ([]byte, error) {
func (p *SignatureS) UnmarshalJSON(data []byte) (err error) {
parsed, err := sigMapper.FromJSON(data)
if err == nil {
if err == nil && parsed != nil {
p.Signature = parsed.(Signature)
}
return