zlepper / itlt

It's the little things mod, a mod about the little things.
MIT License
12 stars 5 forks source link

Launcher detection can fail for paths with insufficient depth #38

Closed diesieben07 closed 2 years ago

diesieben07 commented 2 years ago

Describe the bug LauncherUtils.getDetectedLauncher can throw NPE if the mods folder does not have sufficient depth.

To Reproduce Steps to reproduce the behavior:

  1. Set the game directory to a very shallow path, such as /itlt-test
  2. Run the game.
  3. 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.

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

PaintNinja commented 2 years ago

Thanks for your report, fixed as of v2.1.1 :)