From 9713ad64b3914d45847905cfec7e38d849fdf18d Mon Sep 17 00:00:00 2001 From: huazhongming Date: Thu, 8 Dec 2022 16:04:28 +0800 Subject: [PATCH] fix ssl npe (#11093) --- .../transport/netty4/NettyPortUnificationServerHandler.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyPortUnificationServerHandler.java b/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyPortUnificationServerHandler.java index 3d22ce7a03..338f3572d1 100644 --- a/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyPortUnificationServerHandler.java +++ b/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyPortUnificationServerHandler.java @@ -138,7 +138,9 @@ public class NettyPortUnificationServerHandler extends ByteToMessageDecoder { private void enableSsl(ChannelHandlerContext ctx) { ChannelPipeline p = ctx.pipeline(); - p.addLast("ssl", sslCtx.newHandler(ctx.alloc())); + if (sslCtx != null) { + p.addLast("ssl", sslCtx.newHandler(ctx.alloc())); + } p.addLast("unificationA", new NettyPortUnificationServerHandler(url, sslCtx, false, protocols, handler, dubboChannels, urlMapper, handlerMapper));