aboutsummaryrefslogtreecommitdiffhomepage
path: root/csharp/src/Google.Protobuf
diff options
context:
space:
mode:
authorGravatar Jon Skeet <jonskeet@google.com>2017-10-24 14:14:15 +0100
committerGravatar Jon Skeet <skeet@pobox.com>2017-10-31 17:11:40 -0700
commitcbe250591fca9d2e776776be065a72c5550a5556 (patch)
treeb9b6b3de8fe8af9aaa9238b40611bf09f8f87b65 /csharp/src/Google.Protobuf
parent6dd82243932e929331f3808742b191c85a353461 (diff)
Fix merging with message-valued oneof
If messages A and B have the same oneof case, which is a message type, and we merge B into A, those sub-messages should be merged. Fixes #3200. Note that I haven't regenerated all the code, as some of the protos have been changed, breaking generation.
Diffstat (limited to 'csharp/src/Google.Protobuf')
-rw-r--r--csharp/src/Google.Protobuf/WellKnownTypes/Struct.cs10
1 files changed, 8 insertions, 2 deletions
diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Struct.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Struct.cs
index 1fa35521..65119894 100644
--- a/csharp/src/Google.Protobuf/WellKnownTypes/Struct.cs
+++ b/csharp/src/Google.Protobuf/WellKnownTypes/Struct.cs
@@ -466,10 +466,16 @@ namespace Google.Protobuf.WellKnownTypes {
BoolValue = other.BoolValue;
break;
case KindOneofCase.StructValue:
- StructValue = other.StructValue;
+ if (StructValue == null) {
+ StructValue = new global::Google.Protobuf.WellKnownTypes.Struct();
+ }
+ StructValue.MergeFrom(other.StructValue);
break;
case KindOneofCase.ListValue:
- ListValue = other.ListValue;
+ if (ListValue == null) {
+ ListValue = new global::Google.Protobuf.WellKnownTypes.ListValue();
+ }
+ ListValue.MergeFrom(other.ListValue);
break;
}