NULL port name fix

This commit is contained in:
Alexey Sokolov 2013-03-12 13:57:21 +03:00
parent 7dddbec01d
commit ffd0a5ec9b
1 changed files with 6 additions and 1 deletions

View File

@ -140,7 +140,12 @@ public class SerialPort {
if(portOpened){ if(portOpened){
throw new SerialPortException(portName, "openPort()", SerialPortException.TYPE_PORT_ALREADY_OPENED); throw new SerialPortException(portName, "openPort()", SerialPortException.TYPE_PORT_ALREADY_OPENED);
} }
if(portName != null){
portHandle = serialInterface.openPort(portName); portHandle = serialInterface.openPort(portName);
}
else {
portHandle = -2;//->Since 2.1.0 NULL port name fix
}
//since 0.9.0 -> //since 0.9.0 ->
if(portHandle == -1){ if(portHandle == -1){
throw new SerialPortException(portName, "openPort()", SerialPortException.TYPE_PORT_BUSY); throw new SerialPortException(portName, "openPort()", SerialPortException.TYPE_PORT_BUSY);