Skip to content

Commit

Permalink
fix: Handled NumberFormatException while parsing version number
Browse files Browse the repository at this point in the history
  • Loading branch information
SaptarshiSarkar12 committed Feb 18, 2024
1 parent 1fc1d3d commit efdd0c5
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Core/src/main/java/updater/CheckUpdate.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit efdd0c5

Please sign in to comment.