From 70dad7cd22b3255dc1bbb267a292d895b058f70e Mon Sep 17 00:00:00 2001 From: hellidox <97000871+hellidox@users.noreply.github.com> Date: Thu, 22 Aug 2024 23:04:32 -0500 Subject: [PATCH] Fix crash when you pass an invalid slot number java.lang.ArrayIndexOutOfBoundsException: Index -4 out of bounds for length 36 at java.base/java.util.Arrays$ArrayList.get(Unknown Source) --- .../meteorclient/utils/misc/MeteorStarscript.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/meteordevelopment/meteorclient/utils/misc/MeteorStarscript.java b/src/main/java/meteordevelopment/meteorclient/utils/misc/MeteorStarscript.java index 1f8d352ea4..af321f5ded 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/misc/MeteorStarscript.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/misc/MeteorStarscript.java @@ -387,6 +387,7 @@ private static Value getItem(Starscript ss, int argCount) { if (argCount != 1) ss.error("player.get_item() requires 1 argument, got %d.", argCount); int i = (int) ss.popNumber("First argument to player.get_item() needs to be a number."); + if (i < 0 || i > 35) ss.error("First argument to player.get_item() needs to be between 0 and 35 (inclusive).", i); return mc.player != null ? wrap(mc.player.getInventory().getStack(i)) : Value.null_(); }