From 81311e7516b826b695f1ba221653c96c221ae10b Mon Sep 17 00:00:00 2001 From: Andrew Steinborn Date: Sun, 25 Apr 2021 10:14:13 -0400 Subject: [PATCH] Don't attempt to decode empty buffers (fixes #482) Stuff like this makes me want to drop support for <=1.13 versions of Minecraft. --- .../velocitypowered/proxy/protocol/netty/MinecraftDecoder.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/MinecraftDecoder.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/MinecraftDecoder.java index c648d3e16..5243a6796 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/MinecraftDecoder.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/MinecraftDecoder.java @@ -62,7 +62,7 @@ public class MinecraftDecoder extends ChannelInboundHandlerAdapter { } private void tryDecode(ChannelHandlerContext ctx, ByteBuf buf) throws Exception { - if (!ctx.channel().isActive()) { + if (!ctx.channel().isActive() || !buf.isReadable()) { buf.release(); return; }