From 7ab7c29fe4f3bcdf753e95c7b9385076d792281d Mon Sep 17 00:00:00 2001 From: Gravita Date: Wed, 22 Sep 2021 10:55:35 +0700 Subject: [PATCH] [FIX] Java 7 found crash --- .../src/main/java/pro/gravit/utils/helper/JavaHelper.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/LauncherCore/src/main/java/pro/gravit/utils/helper/JavaHelper.java b/LauncherCore/src/main/java/pro/gravit/utils/helper/JavaHelper.java index 0aa2f236..b8659a3c 100644 --- a/LauncherCore/src/main/java/pro/gravit/utils/helper/JavaHelper.java +++ b/LauncherCore/src/main/java/pro/gravit/utils/helper/JavaHelper.java @@ -141,7 +141,10 @@ public static JavaVersionAndBuild getJavaVersion(String version) { JavaVersionAndBuild result = new JavaVersionAndBuild(); if (version.startsWith("1.")) { 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 { int dot = version.indexOf("."); if (dot != -1) {