diff options
author | Petteri Aimonen <jpa@git.mail.kapsi.fi> | 2019-01-30 14:26:31 +0200 |
---|---|---|
committer | Petteri Aimonen <jpa@git.mail.kapsi.fi> | 2019-01-30 14:26:31 +0200 |
commit | 6c772817cafb6f45f446fef70746a89c8dfdfd47 (patch) | |
tree | dd551186cd35ae3c371b230b332624be39ee0680 | |
parent | e02f9b185276d5a0770856c11e0b965fcb782e13 (diff) | |
download | nanopb-c-6c772817cafb6f45f446fef70746a89c8dfdfd47.tar.gz |
Fix encoding of fixed size arrays inside proto3 submessages (#376)
-rw-r--r-- | pb_encode.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/pb_encode.c b/pb_encode.c index d0129e6..78a3fdb 100644 --- a/pb_encode.c +++ b/pb_encode.c @@ -225,7 +225,10 @@ static bool pb_check_proto3_default_value(const pb_field_t *field, const void *p else if (PB_HTYPE(type) == PB_HTYPE_REPEATED) { /* Repeated fields inside proto3 submessage: present if count != 0 */ - return *(const pb_size_t*)pSize == 0; + if (field->size_offset != 0) + return *(const pb_size_t*)pSize == 0; + else + return false; /* Fixed length array */ } else if (PB_HTYPE(type) == PB_HTYPE_ONEOF) { |