Null check path_override

This commit is contained in:
idk
2022-02-20 20:29:47 -05:00
parent 723b4d0e27
commit 3391c23abd

View File

@@ -97,12 +97,14 @@ public class WinLauncher {
private static File selectHome() { // throws Exception {
String path_override = System.getenv("I2P_CONFIG");
File path = new File(path_override);
if (path.exists()) {
if (path.isDirectory())
return path.getAbsoluteFile();
else
throw new RuntimeException("I2P is not a directory: " + path);
if (path_override != null) {
File path = new File(path_override);
if (path != null && path.exists()) {
if (path.isDirectory())
return path.getAbsoluteFile();
else
throw new RuntimeException("I2P_CONFIG is not a directory: " + path);
}
}
if (SystemVersion.isWindows()) {
File home = new File(System.getProperty("user.home"));
@@ -122,12 +124,14 @@ public class WinLauncher {
private static File selectProgramFile() {
String path_override = System.getenv("I2P");
File path = new File(path_override);
if (path.exists()) {
if (path.isDirectory())
return path.getAbsoluteFile();
else
throw new RuntimeException("I2P is not a directory: " + path);
if (path_override != null) {
File path = new File(path_override);
if (path.exists()) {
if (path.isDirectory())
return path.getAbsoluteFile();
else
throw new RuntimeException("I2P is not a directory: " + path);
}
}
if (SystemVersion.isWindows()) {
File jrehome = new File(System.getProperty("java.home"));