Ensure port handle is valid before reconfiguring timeouts

This commit is contained in:
Will Hedgecock 2022-01-18 13:25:17 -06:00
parent 01d0fdfe80
commit 91a9c0cf72
1 changed files with 2 additions and 1 deletions

View File

@ -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;
}