Fix large message writing

This commit is contained in:
Kai S. K. Engelbart 2020-07-04 08:55:06 +02:00
parent 16b0a338a7
commit 5f4f626206
No known key found for this signature in database
GPG Key ID: 0A48559CA32CB48F
1 changed files with 1 additions and 1 deletions

View File

@ -67,7 +67,7 @@ public class Message {
while (this.length + remaining > capacity)
if (!this.messageBuffer.expandMessage(this)) return -1;
int bytesToCopy = Math.min(remaining, capacity - length);
int bytesToCopy = Math.min(remaining, capacity - this.length);
System.arraycopy(byteArray, offset, sharedArray, this.offset + this.length, bytesToCopy);
this.length += bytesToCopy;
return bytesToCopy;