Fix additional bug with empty message types.

pb_field_next() would access past the fields array.
This commit is contained in:
Petteri Aimonen
2013-03-09 13:12:09 +02:00
parent 60109c0be1
commit e1b8a555f3

View File

@@ -312,6 +312,9 @@ static bool pb_field_next(pb_field_iterator_t *iter)
if (PB_HTYPE(iter->current->type) == PB_HTYPE_REQUIRED)
iter->required_field_index++;
if (iter->current->tag == 0)
return false; /* Only happens with empty message types */
iter->current++;
iter->field_index++;
if (iter->current->tag == 0)