Skip to content

Commit

Permalink
[wpiutil] ProtobufBuffer: Fix buffer reallocation
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterJohnson authored Nov 13, 2023
1 parent c5f2f6a commit dc3d685
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public ByteBuffer write(T value) throws IOException {
m_msg.clearQuick();
m_proto.pack(m_msg, value);
int size = m_msg.getSerializedSize();
if (size < m_buf.capacity()) {
if (size > m_buf.capacity()) {
m_buf = ByteBuffer.allocateDirect(size * 2);
m_sink.setOutput(m_buf);
}
Expand Down

0 comments on commit dc3d685

Please sign in to comment.