isXander / Controlify

Another controller mod - for fabric!
https://www.isxander.dev/mods/controlify
GNU Lesser General Public License v3.0
126 stars 24 forks source link

[Bug] Random crash on Steam deck with IndexOutOfBoundsException on controller tick #237

Closed Da-Boom closed 5 months ago

Da-Boom commented 5 months ago

Current Behaviour

during gameplay the play will crash seemingly at random with an IndexOutOfBoundsException on controller tick

Crash Report: crash-2024-02-04_12.43.30-client.txt

Expected Behaviour

The game continues to run without crashing

Screenshots

No response

Reproduction Steps

  1. Use prism Launcher via flatpak on steam deck
  2. install the "Fabulously Optimized" modpack via modrinth - latest version (5.8.0-beta.8)
  3. Add the modpack as a direct launch non-steam title (using command line: "run" "--branch=stable" "--arch=x86_64" "--command=prismlauncher" "--file-forwarding" "org.prismlauncher.PrismLauncher" '--launch' 'Fabulously Optimized')
  4. Set Controller gyro as mouse or joystic via steam controller settings (i tried both)
  5. launch game in gaming mode
  6. play a world (i used survival, normal difficulty) and wait for crash - last time it happened i walked away from the deck for a brief moment, but its also happened while playing.

Logs

logs as uploaded above

Mod Version

1.8.1+1.20.4

Controller

issues

Bluetooth

Operating System

Linux/SteamOS

ARM

Additional Information

Crash Report: crash-2024-02-04_12.43.30-client.txt

using fabulously optimized modpack via modrinth on latest steam deck beta client (v 1706914901, API SteamClient021)

Just to make sure...

fintmc commented 5 months ago

possible cause: at src/main/java/dev/isxander/controlify/screenop/compat/vanilla/RecipeBookScreenProcessor.java on line 55 it does int index = tabs.indexOf(selectedTab) but doesnt check if the return value is -1, when its not found, instead checks if its not 0, which passes if the value is -1. also later that index variable is used as follows on line 57: button = tabs.get(index - 1);

possible fix:

...
/* L55 */ int index = tabs.indexOf(selectedTab);
// if(index != 0) {  <- bad, passes on -1
/* L56 */ if(index > 0) { // now checks if it's not less than or equal to zero which will not pass on -1
/* L57 */     button = tabs.get(index - 1);
/* L58 */     recipeBookComponent.mouseClicked(button.getX(), button.getY(), 0);
/* L59 */ }
...
arnokeesman commented 5 months ago

this was fixed in #234 it won't even reach that index check now