oniksan/godobuf

bug: clearing repeated fields breaks them

conradhappeliv opened this issue · 2 comments

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.

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.

Bug fixed in v 0.5.0