mirror of
https://github.com/arduino/Arduino.git
synced 2024-12-01 12:24:14 +01:00
null check on SerialPort.readBytes
This commit is contained in:
parent
23086d6b35
commit
991663409a
@ -185,8 +185,11 @@ public class Serial implements SerialPortEventListener {
|
||||
case SerialPortEvent.RXFLAG:
|
||||
try {
|
||||
byte[] bytes = port.readBytes();
|
||||
if (bytes == null) {
|
||||
return;
|
||||
}
|
||||
String bytesAsString = new String(bytes);
|
||||
if(monitor) {
|
||||
if (monitor) {
|
||||
System.out.print(bytesAsString);
|
||||
}
|
||||
if (this.consumer != null) {
|
||||
@ -199,7 +202,6 @@ public class Serial implements SerialPortEventListener {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* This will handle both ints, bytes and chars transparently.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user