Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: clearing repeated fields breaks them #21

Closed
conradhappeliv opened this issue Dec 5, 2021 · 2 comments
Closed

bug: clearing repeated fields breaks them #21

conradhappeliv opened this issue Dec 5, 2021 · 2 comments

Comments

@conradhappeliv
Copy link

I have a repeated proto3 field:

repeated int32 players_in_game = 11;

Adding to the field (msg.add_players_in_game(1)) works fine at first.

However, once you clear the field (msg.clear_players_in_game()), further additions don't work since the field seems to be getting reset to a singular int (I think). Per the language guide, the default value of an cleared repeated field should be an empty array.

Error message:

Invalid call. Nonexistent function 'append' in base 'int'.

For reference, the generated code:

func clear_players_in_game() -> void:
		data[11].state = PB_SERVICE_STATE.UNFILLED
		_players_in_game.value = DEFAULT_VALUES_3[PB_DATA_TYPE.INT32]
func add_players_in_game(value : int) -> void:
		_players_in_game.value.append(value)  # <-- breakage happens here

This is happening on version 0.4.4 on Godot 3.4.

@oniksan
Copy link
Owner

oniksan commented Dec 8, 2021

Hi, conradhappeliv.
I read it, I will definitely check, but so far there is not enough time at all, perhaps it will not be very fast.

conradhappeliv added a commit to conradhappeliv/godobuf that referenced this issue Dec 28, 2021
This should only have two major changes:
- fixes oniksan#21: the "clear" method for repeated fields now sets it to an array instead of the field's type, e.g. int32
- fixes oniksan#22: now has a setter for repeated fields
@oniksan
Copy link
Owner

oniksan commented May 10, 2022

Bug fixed in v 0.5.0

@oniksan oniksan closed this as completed May 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants