mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-17 22:23:10 +03:00
null check on SerialPort.readBytes
This commit is contained in:
@ -185,6 +185,9 @@ public class Serial implements SerialPortEventListener {
|
||||
case SerialPortEvent.RXFLAG:
|
||||
try {
|
||||
byte[] bytes = port.readBytes();
|
||||
if (bytes == null) {
|
||||
return;
|
||||
}
|
||||
String bytesAsString = new String(bytes);
|
||||
if (monitor) {
|
||||
System.out.print(bytesAsString);
|
||||
@ -199,7 +202,6 @@ public class Serial implements SerialPortEventListener {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* This will handle both ints, bytes and chars transparently.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user