[C++] Set StructDef::has_key property when deserializing from binary schema (#7386) (#7428)

This commit is contained in:
sssooonnnggg
2022-08-13 00:27:17 +08:00
committed by GitHub
parent fc5d86f1e7
commit 4be605604e
2 changed files with 31 additions and 0 deletions

View File

@@ -3720,6 +3720,14 @@ bool StructDef::Deserialize(Parser &parser, const reflection::Object *object) {
delete field_def;
return false;
}
if (field_def->key) {
if (has_key) {
// only one field may be set as key
delete field_def;
return false;
}
has_key = true;
}
if (fixed) {
// Recompute padding since that's currently not serialized.
auto size = InlineSize(field_def->value.type);