We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
arduino
Learn more about funding links in repositories.
Report abuse
There was an error while loading. Please reload this page.
1 parent a1027f8 commit 8bf8bdfCopy full SHA for 8bf8bdf
arduino-core/src/processing/app/Serial.java
@@ -191,8 +191,7 @@ public void processSerialEvent(byte[] buf) {
191
int next = 0;
192
while(next < buf.length) {
193
while(next < buf.length && outToMessage.hasRemaining()) {
194
- int spaceInIn = inFromSerial.remaining();
195
- int copyNow = buf.length - next < spaceInIn ? buf.length - next : spaceInIn;
+ int copyNow = Math.min(buf.length - next, inFromSerial.remaining());
196
inFromSerial.put(buf, next, copyNow);
197
next += copyNow;
198
inFromSerial.flip();
0 commit comments