summaryrefslogtreecommitdiffstats
path: root/pb_common.c
diff options
context:
space:
mode:
Diffstat (limited to 'pb_common.c')
-rw-r--r--pb_common.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/pb_common.c b/pb_common.c
index 385c0193..4fb7186b 100644
--- a/pb_common.c
+++ b/pb_common.c
@@ -42,11 +42,11 @@ bool pb_field_iter_next(pb_field_iter_t *iter)
size_t prev_size = prev_field->data_size;
if (PB_HTYPE(prev_field->type) == PB_HTYPE_ONEOF &&
- PB_HTYPE(iter->pos->type) == PB_HTYPE_ONEOF)
+ PB_HTYPE(iter->pos->type) == PB_HTYPE_ONEOF &&
+ iter->pos->data_offset == PB_SIZE_MAX)
{
/* Don't advance pointers inside unions */
- prev_size = 0;
- iter->pData = (char*)iter->pData - prev_field->data_offset;
+ return true;
}
else if (PB_ATYPE(prev_field->type) == PB_ATYPE_STATIC &&
PB_HTYPE(prev_field->type) == PB_HTYPE_REPEATED)