From f53a6928f25d5a0f2592f8415e912b9d59173057 Mon Sep 17 00:00:00 2001 From: BGMP Date: Mon, 31 Aug 2020 05:59:19 -0400 Subject: [PATCH] Fix IOB in 1.13 recipe request --- .../protocol1_13to1_12_2/Protocol1_13To1_12_2.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/Protocol1_13To1_12_2.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/Protocol1_13To1_12_2.java index 64dd82739..92e7f39ea 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/Protocol1_13To1_12_2.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/Protocol1_13To1_12_2.java @@ -826,7 +826,17 @@ public class Protocol1_13To1_12_2 extends Protocol wrapper.write(Type.VAR_INT, Integer.parseInt(wrapper.read(Type.STRING).substring(18)))); + + handler(wrapper -> { + String s = wrapper.read(Type.STRING); + Integer id; + if (s.length() < 19 || (id = Ints.tryParse(s.substring(18))) == null) { + wrapper.cancel(); + return; + } + + wrapper.write(Type.VAR_INT, id); + }); } });