aboutsummaryrefslogtreecommitdiffstats
path: root/pb_encode.c
diff options
context:
space:
mode:
authorPetteri Aimonen <jpa@git.mail.kapsi.fi>2013-07-22 18:59:15 +0300
committerPetteri Aimonen <jpa@git.mail.kapsi.fi>2013-07-22 18:59:15 +0300
commit1f13e8cd2c5bb091677f35e53ae5757774e7d1ba (patch)
tree99bfe3fcafe147f514f00128615a0a7b850d53ea /pb_encode.c
parent64947cb382271e2ab17dbf40ab634846d7d30ad9 (diff)
Fix bugs in extension support when multiple extension fields are present.
Diffstat (limited to 'pb_encode.c')
-rw-r--r--pb_encode.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/pb_encode.c b/pb_encode.c
index 58d76a7a..d6ba7e34 100644
--- a/pb_encode.c
+++ b/pb_encode.c
@@ -161,9 +161,14 @@ static bool checkreturn encode_static_field(pb_ostream_t *stream,
{
pb_encoder_t func;
const void *pSize;
+ bool dummy = true;
func = PB_ENCODERS[PB_LTYPE(field->type)];
- pSize = (const char*)pData + field->size_offset;
+
+ if (field->size_offset)
+ pSize = (const char*)pData + field->size_offset;
+ else
+ pSize = &dummy;
switch (PB_HTYPE(field->type))
{