Any loop function with 1 argument errors out with `java.lang.IndexOutOfBoundsException`
James103 opened this issue ยท 0 comments
As of Carpet mod 1.4.45 for Minecraft 1.17.1, when you use any of the loop functions while
, loop
, map
, filter
, first
, all
, c_for
, for
and reduce
with only one argument, it errors out with the following error:
java.lang.IndexOutOfBoundsException: Index 1 out of bounds for length 1
at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:266)
at java.base/java.util.Objects.checkIndex(Objects.java:359)
at java.base/java.util.ArrayList.get(ArrayList.java:427)
at carpet.script.language.Loops.lambda$apply$25(Loops.java:286)
at carpet.script.language.Loops$$Lambda$5567/0x0000000045d16288.apply(Unknown Source)
at carpet.script.Expression$14.lazyEval(Expression.java:498)
at carpet.script.Expression.lambda$extractOp$19(Expression.java:1294)
at carpet.script.Expression$$Lambda$6496/0x00000000467d6420.evalValue(Unknown Source)
at carpet.script.Expression.evalValue(Expression.java:905)
at carpet.script.Expression.eval(Expression.java:898)
at carpet.script.CarpetExpression.scriptRunCommand(CarpetExpression.java:112)
at carpet.commands.ScriptCommand.lambda$compute$69(ScriptCommand.java:507)
at carpet.commands.ScriptCommand$$Lambda$7454/0x000000005a6148d0.get(Unknown Source)
at carpet.commands.ScriptCommand.handleCall(ScriptCommand.java:439)
at carpet.commands.ScriptCommand.compute(ScriptCommand.java:505)
at carpet.commands.ScriptCommand.lambda$register$17(ScriptCommand.java:144)
at carpet.commands.ScriptCommand$$Lambda$5746/0x00000000459ff8a8.run(Unknown Source)
at com.mojang.brigadier.CommandDispatcher.execute(CommandDispatcher.java:263)
at com.mojang.brigadier.CommandDispatcher.execute(CommandDispatcher.java:177)
at net.minecraft.class_2170.method_9249(class_2170.java:251)
at net.minecraft.class_3244.method_14370(class_3244.java:1222)
at net.minecraft.class_3244.method_31286(class_3244.java:1206)
at net.minecraft.class_3244.method_12048(class_3244.java:1189)
at net.minecraft.class_2797.method_12115(class_2797.java:30)
at net.minecraft.class_2797.method_11054(class_2797.java:7)
at net.minecraft.class_2600.method_11072(class_2600.java:21)
at net.minecraft.class_2600$$Lambda$7041/0x000000004643c210.run(Unknown Source)
at net.minecraft.class_3738.run(class_3738.java:18)
at net.minecraft.class_1255.method_18859(class_1255.java:151)
at net.minecraft.class_4093.method_18859(class_4093.java:23)
at net.minecraft.server.MinecraftServer.method_24306(MinecraftServer.java:788)
at net.minecraft.server.MinecraftServer.method_18859(MinecraftServer.java:164)
at net.minecraft.class_1255.method_16075(class_1255.java:125)
at net.minecraft.server.MinecraftServer.method_20415(MinecraftServer.java:770)
at net.minecraft.server.MinecraftServer.method_16075(MinecraftServer.java:764)
at net.minecraft.class_1255.method_18857(class_1255.java:134)
at net.minecraft.server.MinecraftServer.method_16208(MinecraftServer.java:749)
at net.minecraft.server.MinecraftServer.handler$bcb000$modifiedRunLoop(MinecraftServer.java:4899)
at net.minecraft.server.MinecraftServer.method_29741(MinecraftServer.java:676)
at net.minecraft.server.MinecraftServer.method_29739(MinecraftServer.java:270)
at net.minecraft.server.MinecraftServer$$Lambda$6136/0x00000000461f3168.run(Unknown Source)
at java.base/java.lang.Thread.run(Thread.java:883)
To reproduce, run any of the following in a Scarpet app or /script run
:
while(1)
loop(1)
map([1])
filter([1])
first([1])
all([1])
c_for(1)
for([1])
reduce([1])