summaryrefslogtreecommitdiffstats
path: root/pb_encode.c
diff options
context:
space:
mode:
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))
{