Hi All,
I have compiled the Arduino IDE from the source code I pulled today.
Everything compiled fine and works as far as compiling and uploading codes.
All the menus and windows are opening up just fine.
The only issue I'm getting is when I try using the Serial Monitor window and I receive serial data.
It accepts a few bytes and then raises an exception:
Exception in thread "EventThread COM29" java.lang.NullPointerException
at processing.app.Serial.serialEvent(Serial.java:176)
at jssc.SerialPort$EventThread.run(SerialPort.java:1096)
The line in question is this:
https://github.com/arduino/Arduino/blob/ide-1.5.x/app/src/processing/app/Serial.java#L176
byte[] buf = port.readBytes();
if (buf.length > 0) {
The function readBytes is here:
https://github.com/arduino/Arduino/blob/ide-1.5.x/app/src/processing/app/Serial.java#L248
public synchronized byte[] readBytes() {
if (bufferIndex == bufferLast) return null;
int length = bufferLast - bufferIndex;
byte outgoing[] = new byte[length];
System.arraycopy(buffer, bufferIndex, outgoing, 0, length);
bufferIndex = 0; // rewind
bufferLast = 0;
return outgoing;
}
So, there is a possibility the function would return null if this statement is true:
if (bufferIndex == bufferLast) return null;
I think this is what is causing my exception.
Would this be a bug or something in my compilation that went bad?
Thanks,
RI