Skip to content

Commit

Permalink
Avoid serializing unknown fields twice in reparseMessage (#840)
Browse files Browse the repository at this point in the history
  • Loading branch information
osa1 authored Jun 13, 2023
1 parent edf8e92 commit 0d820ef
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions protobuf/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
* Fix handling `null` values in proto3 JSON deserializer. ([#751], [#760],
[#763])
* Fix handling negative JSON values when parsing uint32 fields. ([#839])
* Avoid serializing unknown fields twice in `reparseMessage`. ([#840])

[#183]: https://github.com/google/protobuf.dart/issues/183
[#644]: https://github.com/google/protobuf.dart/pull/644
Expand All @@ -45,6 +46,7 @@
[#763]: https://github.com/google/protobuf.dart/pull/763
[#754]: https://github.com/google/protobuf.dart/pull/754
[#839]: https://github.com/google/protobuf.dart/pull/839
[#840]: https://github.com/google/protobuf.dart/pull/840

## 2.1.0

Expand Down
6 changes: 3 additions & 3 deletions protobuf/lib/src/protobuf/extension_registry.dart
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@ T _reparseMessage<T extends GeneratedMessage>(
}
});

if (codedBufferWriter.toBuffer().isNotEmpty) {
ensureResult()
.mergeFromBuffer(codedBufferWriter.toBuffer(), extensionRegistry);
final buffer = codedBufferWriter.toBuffer();
if (buffer.isNotEmpty) {
ensureResult().mergeFromBuffer(buffer, extensionRegistry);
}
}

Expand Down

0 comments on commit 0d820ef

Please sign in to comment.