diff options
author | Jie Luo <jieluo@google.com> | 2017-03-10 16:55:35 -0800 |
---|---|---|
committer | Jie Luo <jieluo@google.com> | 2017-03-10 16:58:20 -0800 |
commit | d59592af61852023f549e91683ade4f062c2df83 (patch) | |
tree | f6b02e28502e1abe67c0bad2a899a77fbd3a8537 /src/google/protobuf/util/internal/default_value_objectwriter.cc | |
parent | ae220cda61fe9efb69b3977d6813164e4d5e9a34 (diff) |
DefaultValueObjectWriter should populate oneof message field
Diffstat (limited to 'src/google/protobuf/util/internal/default_value_objectwriter.cc')
-rw-r--r-- | src/google/protobuf/util/internal/default_value_objectwriter.cc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/google/protobuf/util/internal/default_value_objectwriter.cc b/src/google/protobuf/util/internal/default_value_objectwriter.cc index 1772219a..250cf0be 100644 --- a/src/google/protobuf/util/internal/default_value_objectwriter.cc +++ b/src/google/protobuf/util/internal/default_value_objectwriter.cc @@ -363,8 +363,9 @@ void DefaultValueObjectWriter::Node::PopulateChildren( } // If oneof_index() != 0, the child field is part of a "oneof", which means - // the child field is optional and we shouldn't populate its default value. - if (field.oneof_index() != 0) continue; + // the child field is optional and we shouldn't populate its default + // primitive value. + if (field.oneof_index() != 0 && kind == PRIMITIVE) continue; // If the child field is of primitive type, sets its data to the default // value of its type. |