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 bugs in MergeFrom method of dynamic message when merging oneofs #146

Merged
merged 1 commit into from
Aug 3, 2018
Merged
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
6 changes: 3 additions & 3 deletions dynamic/dynamic_message.go
Original file line number Diff line number Diff line change
Expand Up @@ -2469,13 +2469,13 @@ func (m *Message) mergeFrom(pm proto.Message) error {

// one-of fields
for _, oop := range props.OneofTypes {
oov := src.Field(oop.Field)
if oov.Type() != oop.Type {
oov := src.Field(oop.Field).Elem()
if !oov.IsValid() || oov.Type() != oop.Type {
// this field is unset (in other words, one-of message field is not currently set to this option)
continue
}
prop := oop.Prop
rv := oov.FieldByName(prop.Name)
rv := oov.Elem().FieldByName(prop.Name)
fd := m.FindFieldDescriptor(int32(prop.Tag))
if fd == nil {
// Our descriptor has different fields than this message object. So
Expand Down