Only write if > 0 bytes
This commit is contained in:
parent
16cac29f57
commit
3ddd63afb7
1 changed files with 4 additions and 2 deletions
|
@ -22,8 +22,10 @@ int protobuf_encode_length_delimited(int field_number, enum WireType field_type,
|
||||||
varint_encode(incoming_length, &buffer[*bytes_written], max_buffer_length - *bytes_written, &bytes_processed);
|
varint_encode(incoming_length, &buffer[*bytes_written], max_buffer_length - *bytes_written, &bytes_processed);
|
||||||
*bytes_written += bytes_processed;
|
*bytes_written += bytes_processed;
|
||||||
// field value
|
// field value
|
||||||
memcpy(&buffer[*bytes_written], incoming, incoming_length);
|
if (incoming_length > 0) {
|
||||||
*bytes_written += incoming_length;
|
memcpy(&buffer[*bytes_written], incoming, incoming_length);
|
||||||
|
*bytes_written += incoming_length;
|
||||||
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue