diff --git a/transport/src/main/java/io/netty/channel/socket/nio/NioWorker.java b/transport/src/main/java/io/netty/channel/socket/nio/NioWorker.java
index <HASH>..<HASH> 100644
--- a/transport/src/main/java/io/netty/channel/socket/nio/NioWorker.java
+++ b/transport/src/main/java/io/netty/channel/socket/nio/NioWorker.java
@@ -484,7 +484,9 @@ class NioWorker implements Runnable {
                 } catch (AsynchronousCloseException e) {
                     // Doesn't need a user attention - ignore.
                 } catch (Throwable t) {
-                    buf.release();
+                    if (buf != null) {
+                        buf.release();
+                    }
                     channel.currentWriteEvent = null;
                     channel.currentWriteBuffer = null;
                     buf = null;
Fix possible NPE which will be thrown if the Buffer was set to null and after that Exception was thrown. See #<I>