From efdd0c5eeeaa1e3a8dd1537df54b6e4955136c80 Mon Sep 17 00:00:00 2001 From: Saptarshi Sarkar Date: Sun, 18 Feb 2024 13:39:12 +0530 Subject: [PATCH] fix: Handled `NumberFormatException` while parsing version number --- Core/src/main/java/updater/CheckUpdate.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Core/src/main/java/updater/CheckUpdate.java b/Core/src/main/java/updater/CheckUpdate.java index 1bc2afab7..618dd344c 100644 --- a/Core/src/main/java/updater/CheckUpdate.java +++ b/Core/src/main/java/updater/CheckUpdate.java @@ -42,8 +42,12 @@ public static boolean isUpdateAvailable() { String[] currentVersionPartsString = CURRENT_VERSION.split("\\."); String[] latestVersionPartsString = latestVersion.split("\\."); for (int i = 0; i < 3; i++) { - if (Integer.parseInt(currentVersionPartsString[i]) < Integer.parseInt(latestVersionPartsString[i])) { - return true; + try { + if (Integer.parseInt(currentVersionPartsString[i]) < Integer.parseInt(latestVersionPartsString[i])) { + return true; + } + } catch (NumberFormatException e) { + M.msgUpdateError("Failed to parse version number! " + e.getMessage()); } } return false;