src/java.base/share/classes/sun/nio/ch/SelectorImpl.java
changeset 58496 7f34de3cdfe9
parent 58439 b25362cec8ce
child 58679 9c3209ff7550
--- a/src/java.base/share/classes/sun/nio/ch/SelectorImpl.java	Tue Oct 08 10:24:22 2019 +0200
+++ b/src/java.base/share/classes/sun/nio/ch/SelectorImpl.java	Tue Oct 08 10:58:36 2019 +0100
@@ -208,7 +208,8 @@
         if (!(ch instanceof SelChImpl))
             throw new IllegalSelectorException();
         SelectionKeyImpl k = new SelectionKeyImpl((SelChImpl)ch, this);
-        k.attach(attachment);
+        if (attachment != null)
+            k.attach(attachment);
 
         // register (if needed) before adding to key set
         implRegister(k);