Skip to content

Commit

Permalink
Fix if-guard generation around dummy fields
Browse files Browse the repository at this point in the history
  • Loading branch information
Cirras committed Sep 12, 2024
1 parent b839b9a commit af5eb5d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed

- Incorrect (de)serialization of data structures containing both `<dummy>` and `<field>` elements.'
(Only `ChestCloseServerPacket` was impacted.)

## [1.1.1] - 2024-08-22

### Changed
Expand Down
2 changes: 1 addition & 1 deletion protocol_code_generator/generate/object_code_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ def _generate_dummy(self, protocol_dummy):
.build()
)

needs_if_guards = not self._data.serialize and not self._data.deserialize
needs_if_guards = not self._data.serialize.empty or not self._data.deserialize.empty

if needs_if_guards:
self._data.serialize.begin_control_flow("if len(writer) == old_writer_length")
Expand Down

0 comments on commit af5eb5d

Please sign in to comment.