Fix write if the path has no parent

This commit is contained in:
Nassim Jahnke 2024-05-03 19:11:56 +02:00
parent 8149ec3bd0
commit d43da3189e
No known key found for this signature in database
GPG Key ID: EF6771C01F6EF02F
2 changed files with 4 additions and 2 deletions

View File

@ -5,7 +5,7 @@
<groupId>com.viaversion</groupId>
<artifactId>nbt</artifactId>
<version>4.4.4</version>
<version>4.4.5</version>
<packaging>jar</packaging>
<name>ViaNBT</name>

View File

@ -60,7 +60,9 @@ public final class TagWriter {
*/
public void write(final Path path, final Tag tag, final boolean compressed) throws IOException {
if (!Files.exists(path)) {
Files.createDirectories(path.getParent());
if (path.getParent() != null) {
Files.createDirectories(path.getParent());
}
Files.createFile(path);
}