Skip to content

Commit 8edad67

Browse files
committed
Check if the channel is open in BukkitEncodeHandler
1 parent 04e572f commit 8edad67

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

bukkit/src/main/java/com/viaversion/viaversion/bukkit/handlers/BukkitEncodeHandler.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ public BukkitEncodeHandler(final UserConnection connection) {
4343

4444
@Override
4545
protected void encode(final ChannelHandlerContext ctx, final ByteBuf bytebuf, final List<Object> out) throws Exception {
46-
if (!connection.checkClientboundPacket()) {
46+
// Check if the channel is open as older servers might start sending packets through the pipeline despite the channel being closed
47+
if (!connection.checkClientboundPacket() || !ctx.channel().isOpen()) {
4748
throw CancelEncoderException.generate(null);
4849
}
4950
if (!connection.shouldTransformPacket()) {

0 commit comments

Comments
 (0)