Fix crash when typing wrong path
This commit is contained in:
@@ -39,6 +39,7 @@ import org.jackhuang.hmcl.util.platform.OperatingSystem;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
|
import java.nio.file.InvalidPathException;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
@@ -482,7 +483,7 @@ public final class VersionSetting {
|
|||||||
else if (isUsesCustomJavaDir()) {
|
else if (isUsesCustomJavaDir()) {
|
||||||
try {
|
try {
|
||||||
return JavaVersion.fromExecutable(Paths.get(getJavaDir()));
|
return JavaVersion.fromExecutable(Paths.get(getJavaDir()));
|
||||||
} catch (IOException e) {
|
} catch (IOException | InvalidPathException e) {
|
||||||
return null; // Custom Java Directory not found,
|
return null; // Custom Java Directory not found,
|
||||||
}
|
}
|
||||||
} else if (StringUtils.isNotBlank(getJava())) {
|
} else if (StringUtils.isNotBlank(getJava())) {
|
||||||
|
|||||||
Reference in New Issue
Block a user