[Bug] Intermittent crash in inventory screen (ArrayIndexOutOfBoundsException)
Current Behaviour
Sometimes, when interacting fast with inventory screen Minecraft will hard crash. Every time it happens the error in the log is the same, related to Controlify CreativeModeInventoryScreenProcessor and ArrayIndexOutOfBoundsException.
Looking at the CreativeModeInventoryScreenProcessor.java it is logical why it could happen (there are no checks in place) but not why it does happen. Might be worth checking out.
Expected Behaviour
No hard crash
Screenshots
No response
Reproduction Steps
It is not easily reproducible but it does happen from time to time. Only when fast clicking / timing issue?
Logs
Log attached
Mod Version
2.0.0-beta.14+1.21-fabric
Controller
Steam Deck
Bluetooth
- [ ] Yes
Operating System
Linux/SteamOS
ARM
- [ ] Yes
Additional Information
crash-2024-08-23_16.45.20-client.txt
Just to make sure...
- [X] I have made sure I am using the latest version of Controlify for the latest version of Minecraft.
- [X] I have made sure there are no other issues describing the same problem on the issue tracker.
From the Discord:
reporting a bug: when i click the r1 button to cycle through inventory slots it “crashes”after the last one (not really a crash, it saves the world and then quits). able to consistently replicate. using prism launcher 8.4 for minecraft 1.21.1, controlify version 2.0.0-beta.14
Checked, that's how it is reproducible.
- Another log, bit different index and error line:
java.lang.ArrayIndexOutOfBoundsException: Index -1 out of bounds for length 0
at java.base/java.util.ImmutableCollections$ListN.get(ImmutableCollections.java:687)
at dev.isxander.controlify.screenop.compat.vanilla.CreativeModeInventoryScreenProcessor.handleScreenVMouse(CreativeModeInventoryScreenProcessor.java:61)
at dev.isxander.controlify.screenop.ScreenProcessor.onControllerUpdate(ScreenProcessor.java:59)
at dev.isxander.controlify.Controlify.tickController(Controlify.java:564)
at dev.isxander.controlify.Controlify.lambda$tick$41(Controlify.java:513)
at dev.isxander.controlify.utils.ControllerUtils.wrapControllerError(ControllerUtils.java:28)
at dev.isxander.controlify.Controlify.lambda$tick$42(Controlify.java:512)
at java.base/java.util.Optional.ifPresent(Optional.java:178)
at dev.isxander.controlify.Controlify.tick(Controlify.java:511)
at net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents.lambda$static$0(ClientTickEvents.java:34)
at net.minecraft.class_310.handler$bcj000$fabric-lifecycle-events-v1$onStartTick(class_310.java:11678)
at net.minecraft.class_310.method_1574(class_310.java)
at net.minecraft.class_310.method_1523(class_310.java:1246)
at net.minecraft.class_310.method_1514(class_310.java:882)
at net.minecraft.client.main.Main.main(Main.java:256)
at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:480)
at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:74)
at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23)
at org.prismlauncher.launcher.impl.StandardLauncher.launch(StandardLauncher.java:100)
at org.prismlauncher.EntryPoint.listen(EntryPoint.java:129)
at org.prismlauncher.EntryPoint.main(EntryPoint.java:70)
Just to add to the conversation here, I took a look into this problem and discovered it is a Fabric API bug. I've submitted a pull request to Fabric to fix this bug: https://github.com/FabricMC/fabric/pull/4172.
In the interim, disabling the operator tab in the creative menu will mitigate the crash.