diff --git a/src/main/java/com/fazecast/jSerialComm/SerialPort.java b/src/main/java/com/fazecast/jSerialComm/SerialPort.java index c5ee398..2fa1fab 100644 --- a/src/main/java/com/fazecast/jSerialComm/SerialPort.java +++ b/src/main/java/com/fazecast/jSerialComm/SerialPort.java @@ -1017,7 +1017,8 @@ public final class SerialPort { serialEventListener.stopListening(); serialEventListener = null; - configTimeouts(portHandle, timeoutMode, readTimeout, writeTimeout, eventFlags); + if (portHandle != 0) + configTimeouts(portHandle, timeoutMode, readTimeout, writeTimeout, eventFlags); } userDataListener = null; }