1
0
mirror of https://github.com/SKCraft/Launcher.git synced 2024-11-27 12:46:22 +01:00

Fix Java version parser to tolerate missing minor version

Some (all?) Java 17 release files don't have the minor version present,
so a previous assumption no longer holds.
This commit is contained in:
Henry Le Grys 2021-09-27 22:16:34 +01:00
parent 9bd7df4d3c
commit cd063304fb

View File

@ -33,11 +33,7 @@ public class JavaRuntime implements Comparable<JavaRuntime> {
String[] parts = version.split("\\.");
if (parts.length < 2) {
throw new IllegalArgumentException("Invalid Java runtime version: " + version);
}
if (parts[0].equals("1")) {
if (parts[0].equals("1") && parts.length > 1) {
return Integer.parseInt(parts[1]);
} else {
return Integer.parseInt(parts[0]);