#vulnerable code 
                                @Override
    public void channelInactive(ChannelHandlerContext ctx) throws Exception {
        SocketChannel channel = (SocketChannel) ctx.channel();
        String nodeId = IpUtil.getNodeId(channel.remoteAddress());
        Log.debug(" ---------------------- server channelInactive ------------------------- " + nodeId);

        String channelId = ctx.channel().id().asLongText();
        NioChannelMap.remove(channelId);
        Node node = getNetworkService().getNode(nodeId);
        if (node != null) {
            if (channelId.equals(node.getChannelId())) {
//                System.out.println("------------ sever channelInactive remove node-------------" + node.getId());
                getNetworkService().removeNode(nodeId);
            } else {
                Log.debug("--------------channel id different----------------------");
                Log.debug(node.getChannelId());
                Log.debug(channelId);
            }
        }
    } 
                            #location 9 
                            #vulnerability type NULL_DEREFERENCE
#fixed code
                                @Override
    public void channelInactive(ChannelHandlerContext ctx) throws Exception {
        SocketChannel channel = (SocketChannel) ctx.channel();
        String nodeId = IpUtil.getNodeId(channel.remoteAddress());
        Log.debug(" ---------------------- server channelInactive ------------------------- " + nodeId);

        String channelId = ctx.channel().id().asLongText();
        NioChannelMap.remove(channelId);
        Node node = networkService.getNode(nodeId);

        if (node != null) {
            if (channelId.equals(node.getChannelId())) {
//                System.out.println("------------ sever channelInactive remove node-------------" + node.getId());
                networkService.removeNode(nodeId);
            } else {
                Log.info("--------------server channel id different----------------------");
                Log.info("--------node:" + node.getId() + ",type:" + node.getType());
                Log.info(node.getChannelId());
                Log.info(channelId);
            }
        }
    }