diff options
author | Adam Cozzette <acozzette@google.com> | 2018-05-25 14:12:43 -0700 |
---|---|---|
committer | Adam Cozzette <acozzette@google.com> | 2018-05-25 14:44:22 -0700 |
commit | d1af029104e9b594a99209484914b822addb08fa (patch) | |
tree | ea2c0cfe72f25c79e6bb0e0d7f8f4da320cc3c4a /src | |
parent | 6f723a6624de0e0f9b1ae16ae002e678613e07b8 (diff) |
Fixed JS parsing of unspecified map keys
We need to use a default of 0 when parsing unspecified map keys, instead
of failing an assertion.
This change was written by Michael Aaron (michaelaaron@google.com) but I
am cherry-picking it directly instead of waiting for the next sync of
Google-internal changes.
Diffstat (limited to 'src')
-rwxr-xr-x | src/google/protobuf/compiler/js/js_generator.cc | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/google/protobuf/compiler/js/js_generator.cc b/src/google/protobuf/compiler/js/js_generator.cc index d8282e40..b5771f26 100755 --- a/src/google/protobuf/compiler/js/js_generator.cc +++ b/src/google/protobuf/compiler/js/js_generator.cc @@ -2962,8 +2962,12 @@ void Generator::GenerateClassDeserializeBinaryField( if (value_field->type() == FieldDescriptor::TYPE_MESSAGE) { printer->Print(", $messageType$.deserializeBinaryFromReader", "messageType", GetMessagePath(options, value_field->message_type())); + } else { + printer->Print(", null"); } - + printer->Print(", $defaultKey$", + "defaultKey", JSFieldDefault(key_field) + ); printer->Print(");\n"); printer->Print(" });\n"); } else { |