Launcher detection can fail for paths with insufficient depth
diesieben07 opened this issue ยท 1 comments
Describe the bug
LauncherUtils.getDetectedLauncher can throw NPE if the mods folder does not have sufficient depth.
To Reproduce
Steps to reproduce the behavior:
- Set the game directory to a very shallow path, such as
/itlt-test
- Run the game.
- Observe the game crashing.
Expected behavior
The game does not crash.
Environment details
Please fill in what you know, skip any parts you don't know.
- Operating system (e.g. Windows 10): Linux Mint (irrelevant to the issue)
- Java (e.g. AdoptOpenJDK 8 HotSpot): java version 17.0.1 by Microsoft
- Mod version (e.g. 1.16.5-2.0.0): 1.18-2.1.0
- Minecraft version (e.g. 1.16.5): 1.18.2
Logs and additional context
Caused by: java.lang.NullPointerException: Cannot invoke "java.nio.file.Path.resolve(String)" because "theoreticalTechnicPath" is null
at dk.zlepper.itlt.client.launchers.LauncherUtils.getDetectedLauncher(LauncherUtils.java:27) ~[itlt-1.18-2.1.0.jar%2352!/:1.18-2.1.0]
at dk.zlepper.itlt.client.ClientModEvents.<clinit>(ClientModEvents.java:39) ~[itlt-1.18-2.1.0.jar%2352!/:1.18-2.1.0]
... 14 more
https://gist.github.com/diesieben07/dda64ec8c88dcebc54b19a2adffc2f4d