Ensure port handle exists before closing it
This commit is contained in:
parent
79d09f38c9
commit
20ea873390
|
@ -506,7 +506,8 @@ public final class SerialPort
|
|||
{
|
||||
if (serialEventListener != null)
|
||||
serialEventListener.stopListening();
|
||||
portHandle = closePortNative(portHandle);
|
||||
if (portHandle > 0)
|
||||
portHandle = closePortNative(portHandle);
|
||||
return (portHandle < 0);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue