1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-23 19:21:59 +03:00

Fixed NPE when RXCHAR event with no bytes. Closes #1885

This commit is contained in:
Federico Fissore
2014-02-21 11:14:30 +01:00
parent c39a6a26da
commit 79eb32f816
2 changed files with 6 additions and 1 deletions

View File

@ -175,7 +175,7 @@ public class Serial implements SerialPortEventListener {
public synchronized void serialEvent(SerialPortEvent serialEvent) {
if (serialEvent.isRXCHAR()) {
try {
byte[] buf = port.readBytes();
byte[] buf = port.readBytes(serialEvent.getEventValue());
if (buf.length > 0) {
if (bufferLast == buffer.length) {
byte temp[] = new byte[bufferLast << 1];