This normally works, except when the map key is 0.
For example, this code is broken because from_bytes returns error REQUIRED_FIELDS:
var s = API.GameState.new()
s.add_player_data(0)
print(s.from_bytes(s.to_bytes())) # Prints -9, aka "REQUIRED_FIELDS".
However, when I change the map key to something else (e.g. 1), deserialization works fine.
I assume this is due to improper handling of default values as map keys. I haven't tested it, but I assume the same issue is present for other default types (e.g. empty strings).
I have a proto3 map field with
int32
keys:This normally works, except when the map key is
0
.For example, this code is broken because
from_bytes
returns errorREQUIRED_FIELDS
:However, when I change the map key to something else (e.g.
1
), deserialization works fine.I assume this is due to improper handling of default values as map keys. I haven't tested it, but I assume the same issue is present for other default types (e.g. empty strings).