mirror of
https://github.com/protocolbuffers/protobuf-go.git
synced 2025-01-01 03:14:16 +00:00
internal/impl: fix legacy UnmarshalJSONEnum
The conditional was accidentally inverted. This function provides dubious support for encoding/json. Change-Id: Ib4131a229afa14d9aef1ad31fec51f4dac417a3b Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/210638 Reviewed-by: Damien Neil <dneil@google.com>
This commit is contained in:
parent
4663ebc852
commit
62d204ccc3
@ -45,7 +45,7 @@ func (Export) UnmarshalJSONEnum(ed pref.EnumDescriptor, b []byte) (pref.EnumNumb
|
||||
return 0, errors.New("invalid input for enum %v: %s", ed.FullName(), b)
|
||||
}
|
||||
ev := ed.Values().ByName(name)
|
||||
if ev != nil {
|
||||
if ev == nil {
|
||||
return 0, errors.New("invalid value for enum %v: %s", ed.FullName(), name)
|
||||
}
|
||||
return ev.Number(), nil
|
||||
|
Loading…
Reference in New Issue
Block a user