Mojang / slicer

Resource pack migration tool for Minecraft 1.14
MIT License
174 stars 7 forks source link

NullPointerException when running the program using local paths. #2

Closed ThEnderYoshi closed 1 year ago

ThEnderYoshi commented 1 year ago

I ran the program from .minecraft/resourcepacks/, so I could make the paths shorter.

Here is what I ran:

> java -jar slicer-1.20.2-1.1-SNAPSHOT.jar ULTRAMINIMAL_old ULTRAMINIMAL
Exception in thread "main" java.lang.NullPointerException: Cannot invoke "java.nio.file.Path.getFileSystem()" because "path" is null
        at java.base/java.nio.file.Files.provider(Files.java:105)
        at java.base/java.nio.file.Files.createDirectory(Files.java:700)
        at java.base/java.nio.file.Files.createAndCheckIsDirectory(Files.java:807)
        at java.base/java.nio.file.Files.createDirectories(Files.java:753)
        at com.mojang.slicer.Slicer.parse(Slicer.java:43)
        at com.mojang.slicer.Main.main(Main.java:773)

And here is line 43 of Slicer.java (as of writing this):

Files.createDirectories(outputPath.getParent());

Running from .minecraft/ instead has no issues.

It seems Paths.getParent() is returning null since ULTRAMINIMAL doesn't have a parent in its path. The fix should be as simple as making the paths absolute.