Fix IOB in 1.13 recipe request

Fixes #2039
This commit is contained in:
KennyTV 2020-08-27 09:37:51 +02:00
parent 28219a3993
commit 78bb5f171f
No known key found for this signature in database
GPG Key ID: 6BE3B555EBC5982B

View File

@ -841,9 +841,10 @@ public class Protocol1_13To1_12_2 extends Protocol<ClientboundPackets1_12_1, Cli
int type = wrapper.get(Type.VAR_INT, 0); int type = wrapper.get(Type.VAR_INT, 0);
if (type == 0) { if (type == 0) {
Integer id = Ints.tryParse(wrapper.read(Type.STRING).substring(18)); String s = wrapper.read(Type.STRING);
Integer id;
// Custom recipes // Custom recipes
if (id == null) { if (s.length() < 19 || (id = Ints.tryParse(s.substring(18))) == null) {
wrapper.cancel(); wrapper.cancel();
return; return;
} }