Fix a NullPointerException when people specify a path in the same directory without a parent. (#6)

* Update OptimizedOBJConverter.java

* Update OBJConverter.java
This commit is contained in:
cire3 2024-07-15 00:05:29 -05:00 committed by GitHub
parent 9e0f5a5f3d
commit d9fcea6190
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 6 deletions

View File

@ -50,9 +50,10 @@ public class OBJConverter {
System.out.println("Exporting " + (v1_8 ? "1.8" : "1.5") + " MDL: " + output.getAbsolutePath());
boolean tex = args[2].equalsIgnoreCase("true") || args[2].equals("1");
if (!output.exists()) {
if (!output.getParentFile().exists())
if (!output.getParentFile().mkdirs())
throw new RuntimeException("Failed to create parent dir!");
if (output.getParentFile() != null)
if (!output.getParentFile().exists())
if (!output.getParentFile().mkdirs())
throw new RuntimeException("Failed to create parent dir!");
if (!output.createNewFile())
throw new RuntimeException("Failed to create file!");
}

View File

@ -25,9 +25,10 @@ public class OptimizedOBJConverter {
System.out.println("Exporting " + (v1_8 ? "1.8" : "1.5") + " MDL: " + output.getAbsolutePath());
boolean tex = args[2].equalsIgnoreCase("true") || args[2].equals("1");
if (!output.exists()) {
if (!output.getParentFile().exists())
if (!output.getParentFile().mkdirs())
throw new RuntimeException("Failed to create parent dir!");
if (output.getParentFile() != null)
if (!output.getParentFile().exists())
if (!output.getParentFile().mkdirs())
throw new RuntimeException("Failed to create parent dir!");
if (!output.createNewFile())
throw new RuntimeException("Failed to create file!");
}