summaryrefslogtreecommitdiffstats
path: root/vendor/google.golang.org/protobuf/internal/impl
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/google.golang.org/protobuf/internal/impl')
-rw-r--r--vendor/google.golang.org/protobuf/internal/impl/legacy_message.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/vendor/google.golang.org/protobuf/internal/impl/legacy_message.go b/vendor/google.golang.org/protobuf/internal/impl/legacy_message.go
index 3759b010..029feeef 100644
--- a/vendor/google.golang.org/protobuf/internal/impl/legacy_message.go
+++ b/vendor/google.golang.org/protobuf/internal/impl/legacy_message.go
@@ -440,6 +440,13 @@ func legacyMerge(in piface.MergeInput) piface.MergeOutput {
if !ok {
return piface.MergeOutput{}
}
+ if !in.Source.IsValid() {
+ // Legacy Marshal methods may not function on nil messages.
+ // Check for a typed nil source only after we confirm that
+ // legacy Marshal/Unmarshal methods are present, for
+ // consistency.
+ return piface.MergeOutput{Flags: piface.MergeComplete}
+ }
b, err := marshaler.Marshal()
if err != nil {
return piface.MergeOutput{}