Fix missing error messages in pb_encode.c
This commit is contained in:
@@ -224,7 +224,7 @@ static bool checkreturn encode_basic_field(pb_ostream_t *stream,
|
|||||||
{
|
{
|
||||||
case PB_HTYPE_REQUIRED:
|
case PB_HTYPE_REQUIRED:
|
||||||
if (!pData)
|
if (!pData)
|
||||||
return false;
|
PB_RETURN_ERROR(stream, "missing required field");
|
||||||
if (!pb_encode_tag_for_field(stream, field))
|
if (!pb_encode_tag_for_field(stream, field))
|
||||||
return false;
|
return false;
|
||||||
if (!func(stream, field, pData))
|
if (!func(stream, field, pData))
|
||||||
@@ -496,7 +496,12 @@ bool checkreturn pb_encode_submessage(pb_ostream_t *stream, const pb_field_t fie
|
|||||||
bool status;
|
bool status;
|
||||||
|
|
||||||
if (!pb_encode(&substream, fields, src_struct))
|
if (!pb_encode(&substream, fields, src_struct))
|
||||||
|
{
|
||||||
|
#ifndef PB_NO_ERRMSG
|
||||||
|
stream->errmsg = substream.errmsg;
|
||||||
|
#endif
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
size = substream.bytes_written;
|
size = substream.bytes_written;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user