[FIX] Java 7 found crash

This commit is contained in:
Gravita 2021-09-22 10:55:35 +07:00
parent 04c854703e
commit 7ab7c29fe4

View file

@ -141,7 +141,10 @@ public static JavaVersionAndBuild getJavaVersion(String version) {
JavaVersionAndBuild result = new JavaVersionAndBuild(); JavaVersionAndBuild result = new JavaVersionAndBuild();
if (version.startsWith("1.")) { if (version.startsWith("1.")) {
result.version = Integer.parseInt(version.substring(2, 3)); result.version = Integer.parseInt(version.substring(2, 3));
result.build = Integer.parseInt(version.substring(version.indexOf('_') + 1)); int pos = version.indexOf('_');
if (pos != -1) {
result.build = Integer.parseInt(version.substring(pos + 1));
}
} else { } else {
int dot = version.indexOf("."); int dot = version.indexOf(".");
if (dot != -1) { if (dot != -1) {