Skip to content

Commit eb24128

Browse files
rozzajyemin
authored andcommitted
Fix race condition causing an NPE in tlschannel
JAVA-3714
1 parent d82a603 commit eb24128

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

driver-core/src/main/com/mongodb/internal/connection/tlschannel/async/AsynchronousTlsChannelGroup.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,9 @@ class RegisteredSocket {
121121
public void close() {
122122
doCancelRead(this, null);
123123
doCancelWrite(this, null);
124-
key.cancel();
124+
if (key != null) {
125+
key.cancel();
126+
}
125127
currentRegistrations.getAndDecrement();
126128
/*
127129
* Actual de-registration from the selector will happen asynchronously.

0 commit comments

Comments
 (0)