What steps will reproduce the problem?
1. Write .proto file which includes a message with no fields.
2. Compile the .proto file.
3. Attempt to decode any stream using that no-fields message.
The result: a "missing required field" error always occurs, even though the
no-fields message doesn't have any required fields.
Here is a possible patch:
--- nanopb/pb_decode_old.c 2013-03-09 20:57:41 +1100
+++ nanopb/pb_decode_new.c 2013-03-09 20:58:16 +1100
@@ -571,7 +571,7 @@
} while (pb_field_next(&iter));
/* Fixup if last field was also required. */
- if (PB_HTYPE(last_type) == PB_HTYPE_REQUIRED)
+ if (PB_HTYPE(last_type) == PB_HTYPE_REQUIRED && iter.current->tag)
req_field_count++;
/* Check the whole bytes */
Original issue reported on code.google.com by someon...@gmail.com on 9 Mar 2013 at 10:08
Original issue reported on code.google.com by
someon...@gmail.com
on 9 Mar 2013 at 10:08