Don't try to close the serial port if it wasn't opened.

This commit is contained in:
akwizgran
2012-12-06 14:07:19 +00:00
parent 4ece151df8
commit 80f5e0a7ff

View File

@@ -56,6 +56,10 @@ class ModemImpl implements Modem, WriteHandler, SerialPortEventListener {
try {
if(!port.openPort())
throw new IOException("Failed to open serial port");
} catch(SerialPortException e) {
throw new IOException(e.toString());
}
try {
boolean foundBaudRate = false;
for(int baudRate : BAUD_RATES) {
if(port.setParams(baudRate, 8, 1, 0)) {