You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Per this documentation: https://developers.google.com/protocol-buffers/docs/proto3#default fields are supposed to return their default value even if the parsed proto doesn't contain that value. Right now, I have to manually check for hasField() and implement the default value myself.
Same thing for "owned_by_team": if it's 0, my proto doesn't contain data, and I have to manually check for hasOwnedbyTeam() and then assume 0 if it's missing, instead of just doing getOwnedByTeam()->value().
Per this documentation: https://developers.google.com/protocol-buffers/docs/proto3#default fields are supposed to return their default value even if the parsed proto doesn't contain that value. Right now, I have to manually check for
hasField()
and implement the default value myself.For example, check out FortType in this proto:
https://github.com/AeonLucid/POGOProtos/blob/master/src/POGOProtos/Map/Fort/FortData.proto
For FortType::GYM (0), my FortData proto doesn't contain any value on type, so getType() will return null, instead it should return FortType::GYM() (the first defined enum value).
Same thing for "owned_by_team": if it's 0, my proto doesn't contain data, and I have to manually check for hasOwnedbyTeam() and then assume 0 if it's missing, instead of just doing getOwnedByTeam()->value().
I shouldn't have to do this work myself judging from the specs.
Same thing applies to proto2: https://developers.google.com/protocol-buffers/docs/proto#optional
The text was updated successfully, but these errors were encountered: