diff options
author | Petteri Aimonen <jpa@npb.mail.kapsi.fi> | 2011-08-23 15:57:47 +0000 |
---|---|---|
committer | Petteri Aimonen <jpa@npb.mail.kapsi.fi> | 2011-08-23 15:57:47 +0000 |
commit | 9966a8c9b680ada47b6bd5fe96405c0abaf773e4 (patch) | |
tree | 27cb83a34cc722c1414dc531c36b4104b601aa63 /pb_decode.c | |
parent | 7780da38e88027370009afda5a9b6dc93a4168d4 (diff) |
more unittests
git-svn-id: https://svn.kapsi.fi/jpa/nanopb@964 e3a754e5-d11d-0410-8d38-ebb782a927b9
Diffstat (limited to 'pb_decode.c')
-rw-r--r-- | pb_decode.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/pb_decode.c b/pb_decode.c index 0e55cbfb..6c6b1d9e 100644 --- a/pb_decode.c +++ b/pb_decode.c @@ -337,17 +337,14 @@ bool checkreturn pb_decode(pb_istream_t *stream, const pb_field_t fields[], void pb_field_iterator_t iter; int i; - if (fields[0].tag == 0) - { - /* No fields -> nothing to do */ - return pb_read(stream, NULL, stream->bytes_left); - } - pb_field_init(&iter, fields, dest_struct); /* Initialize size/has fields and apply default values */ do { + if (iter.current->tag == 0) + continue; + if (PB_HTYPE(iter.current->type) == PB_HTYPE_OPTIONAL) { *(bool*)iter.pSize = false; |