From 09d580325c85a128ce9ca37f1cb0de678e49d4db Mon Sep 17 00:00:00 2001 From: zhaolianwang Date: Wed, 26 Sep 2018 18:12:11 +0800 Subject: [PATCH] fix nullpoint https://github.com/mrniko/netty-socketio/issues/596 reason: WebSocketTransport line 144 : Packet packet = new Packet(PacketType.MESSAGE); //subType =null PacketEncoder line 288: byte subType = toChar(packet.getSubType().getValue()); //NullPointerException fix WebSocketTransport Packet packet = new Packet(PacketType.MESSAGE); packet.setSubType(PacketType.MESSAGE); --- .../corundumstudio/socketio/transport/WebSocketTransport.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/corundumstudio/socketio/transport/WebSocketTransport.java b/src/main/java/com/corundumstudio/socketio/transport/WebSocketTransport.java index e413a5bb..058bc097 100644 --- a/src/main/java/com/corundumstudio/socketio/transport/WebSocketTransport.java +++ b/src/main/java/com/corundumstudio/socketio/transport/WebSocketTransport.java @@ -142,6 +142,7 @@ public void channelInactive(ChannelHandlerContext ctx) throws Exception { final Channel channel = ctx.channel(); ClientHead client = clientsBox.get(channel); Packet packet = new Packet(PacketType.MESSAGE); + packet.setSubType(PacketType.MESSAGE); if (client != null && client.isTransportChannel(ctx.channel(), Transport.WEBSOCKET)) { log.debug("channel inactive {}", client.getSessionId()); client.onChannelDisconnect();