Skip to content

Commit cbb5a9f

Browse files
committed
Added closeport guard
1 parent 33a0245 commit cbb5a9f

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/main/java/jssc/SerialPort.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1182,6 +1182,7 @@ public synchronized boolean removeEventListener() throws SerialPortException {
11821182
* @throws SerialPortException if exception occurred
11831183
*/
11841184
public synchronized boolean closePort() throws SerialPortException {
1185+
if (!portOpened) return false;
11851186
boolean returnValue;
11861187
//removeEventListener calls setEventsMask, and must occur before calling closePort
11871188
try {

0 commit comments

Comments
 (0)