aboutsummaryrefslogtreecommitdiffstats
path: root/pb_decode.c
diff options
context:
space:
mode:
authorBernhard Krämer <bdkrae@gmail.com>2016-10-09 20:26:28 +0200
committerBernhard Krämer <bdkrae@gmail.com>2016-10-09 20:26:28 +0200
commitba97926cfd1e82bd294cf5e484633850d8e0b368 (patch)
tree41aa38edf6cf9b87e318287b6497a01940700551 /pb_decode.c
parent91bb64a47b36b112c9b22391ef76fab29cf2cffc (diff)
Add proto3 option to handle singular fields
Diffstat (limited to 'pb_decode.c')
-rw-r--r--pb_decode.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/pb_decode.c b/pb_decode.c
index 7a4e29a8..1f6aeae0 100644
--- a/pb_decode.c
+++ b/pb_decode.c
@@ -360,7 +360,8 @@ static bool checkreturn decode_static_field(pb_istream_t *stream, pb_wire_type_t
return func(stream, iter->pos, iter->pData);
case PB_HTYPE_OPTIONAL:
- *(bool*)iter->pSize = true;
+ if (iter->pSize != iter->pData)
+ *(bool*)iter->pSize = true;
return func(stream, iter->pos, iter->pData);
case PB_HTYPE_REPEATED: