We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b40f54a commit 990e934Copy full SHA for 990e934
arduino-core/src/processing/app/Serial.java
@@ -178,8 +178,7 @@ public synchronized void serialEvent(SerialPortEvent serialEvent) {
178
int next = 0;
179
while(next < buf.length) {
180
while(next < buf.length && outToMessage.hasRemaining()) {
181
- int spaceInIn = inFromSerial.remaining();
182
- int copyNow = buf.length - next < spaceInIn ? buf.length - next : spaceInIn;
+ int copyNow = Math.min(buf.length - next, inFromSerial.remaining());
183
inFromSerial.put(buf, next, copyNow);
184
next += copyNow;
185
inFromSerial.flip();
0 commit comments