diff options
author | Petteri Aimonen <jpa@git.mail.kapsi.fi> | 2013-12-29 18:34:57 +0200 |
---|---|---|
committer | Petteri Aimonen <jpa@git.mail.kapsi.fi> | 2013-12-29 18:35:57 +0200 |
commit | bc4ded3b4314e0fbd181b3cc01635052b56d2b19 (patch) | |
tree | 688f36233720ca8ddf340807c1a115c50167f2f4 | |
parent | ef07635e3549b6a3ab6a6bafc12b7960ac6b1ab9 (diff) |
Fix missing error messages in pb_encode.c
-rw-r--r-- | pb_encode.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/pb_encode.c b/pb_encode.c index 476b1119..c2d0e2c4 100644 --- a/pb_encode.c +++ b/pb_encode.c @@ -226,7 +226,7 @@ static bool checkreturn encode_basic_field(pb_ostream_t *stream, { case PB_HTYPE_REQUIRED: if (!pData) - return false; + PB_RETURN_ERROR(stream, "missing required field"); if (!pb_encode_tag_for_field(stream, field)) return false; if (!func(stream, field, pData)) @@ -499,7 +499,12 @@ bool checkreturn pb_encode_submessage(pb_ostream_t *stream, const pb_field_t fie bool status; if (!pb_encode(&substream, fields, src_struct)) + { +#ifndef PB_NO_ERRMSG + stream->errmsg = substream.errmsg; +#endif return false; + } size = substream.bytes_written; |