DefaultSettings

DefaultSettings

16M Downloads

scancode keys crash CoreUtil.restoreKeys

pali6 opened this issue ยท 5 comments

commented

Version: 4.0.6

Stack trace:

Thread: Render thread
Suspected Mods: NONE
Stacktrace:
	at java.lang.String.checkBoundsBeginEnd(String.java:4606) ~[?:?] {re:mixin}
-- MOD defaultsettings --
Details:
	Mod File: /C:/Users/6pali/curseforge/minecraft/Instances/All the Mods 9 - ATM9/mods/DefaultSettings-1.20.x-4.0.6-Forge.jar
	Failure message: DefaultSettings (defaultsettings) encountered an error during the complete event phase
		java.lang.StringIndexOutOfBoundsException: begin 4, end 0, length 0
	Mod Version: 4.0.6
	Mod Issue URL: NOT PROVIDED
	Exception message: java.lang.StringIndexOutOfBoundsException: begin 4, end 0, length 0
Stacktrace:
	at java.lang.String.checkBoundsBeginEnd(String.java:4606) ~[?:?] {re:mixin}
	at java.lang.String.substring(String.java:2709) ~[?:?] {re:mixin}
	at java.lang.String.substring(String.java:2682) ~[?:?] {re:mixin}
	at net.jomcraft.defaultsettings.CoreUtil.restoreKeys(CoreUtil.java:95) ~[DefaultSettings-1.20.x-4.0.6-Forge.jar%23781!/:4.0.6] {re:classloading}
	at net.jomcraft.defaultsettings.FileUtil.restoreKeys(FileUtil.java:55) ~[DefaultSettings-1.20.x-4.0.6-Forge.jar%23781!/:4.0.6] {re:classloading}
	at net.jomcraft.defaultsettings.DefaultSettings.lambda$postInit$10(DefaultSettings.java:166) ~[DefaultSettings-1.20.x-4.0.6-Forge.jar%23781!/:4.0.6] {re:classloading}
	at net.minecraftforge.fml.DistExecutor.unsafeRunWhenOn(DistExecutor.java:111) ~[fmlcore-1.20.1-47.2.19.jar%231147!/:?] {re:mixin}
	at net.minecraftforge.fml.DistExecutor.runWhenOn(DistExecutor.java:95) ~[fmlcore-1.20.1-47.2.19.jar%231147!/:?] {re:mixin}
	at net.jomcraft.defaultsettings.DefaultSettings.postInit(DefaultSettings.java:163) ~[DefaultSettings-1.20.x-4.0.6-Forge.jar%23781!/:4.0.6] {re:classloading}
	at net.minecraftforge.eventbus.EventBus.doCastFilter(EventBus.java:260) ~[eventbus-6.0.5.jar%2387!/:?] {}
	at net.minecraftforge.eventbus.EventBus.lambda$addListener$11(EventBus.java:252) ~[eventbus-6.0.5.jar%2387!/:?] {}
	at net.minecraftforge.eventbus.EventBus.post(EventBus.java:315) ~[eventbus-6.0.5.jar%2387!/:?] {}
	at net.minecraftforge.eventbus.EventBus.post(EventBus.java:296) ~[eventbus-6.0.5.jar%2387!/:?] {}
	at net.minecraftforge.fml.javafmlmod.FMLModContainer.acceptEvent(FMLModContainer.java:114) ~[javafmllanguage-1.20.1-47.2.19.jar%231148!/:?] {}
	at net.minecraftforge.fml.ModContainer.lambda$buildTransitionHandler$4(ModContainer.java:125) ~[fmlcore-1.20.1-47.2.19.jar%231147!/:?] {re:mixin}
	at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1804) ~[?:?] {}
	at java.util.concurrent.CompletableFuture$AsyncRun.exec(CompletableFuture.java:1796) ~[?:?] {}
	at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373) ~[?:?] {}
	at java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182) ~[?:?] {}
	at java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655) ~[?:?] {re:mixin,re:computing_frames}
	at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622) ~[?:?] {re:mixin,re:computing_frames}
	at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165) ~[?:?] {re:mixin}

Example options.txt line that causes a crash: key_key.fire_ability_one:scancode.72

if (parts[parts.length - 1].contains("key.") || numberParsable(parts[parts.length - 1])) {
Logic on this line seems to be incorrect and/or outdated. The example options.txt line above fails both of those checks but since it has only one : the else branch will generate an empty keyName. Most likely the numberParsable check should be changed to accept scancode.[number] too. Or the else branch should always read at least one part instead of potentially reading zero.

I can PR a fix if you want but I'm slightly confused about the way you have submodule structure set up. Is the branch cerium-core a submodule on main / main-1.20?

commented

Hey,

thanks a lot for the detailed report! I'll look into this ASAP (ideally tomorrow).

And you're correct about the submodule structure. I use the cerium-core branch as a submodule for the two branches you named. This streamlined the process of applying changes on all MC versions from 1.7 to 1.20.

commented

The two main branches have been updated. As soon as the GitHub actions finish, you can download the fixed versions here: 1.20+ and below 1.20. The artifact ZIP files contain every JAR for all currently supported versions of the game.

Could you check if it now works fine with that fixed version (4.0.7)? If that's the case I'll later publish it on CF.

commented

~ Accidentally closed, reopening.

commented

Yep, fixed. Thanks!

commented

~ Version 4.0.7 has been published for Fabric, Forge and NeoForge.