From 00cfe78491f341f8994d24c972966a7b1b626b2c Mon Sep 17 00:00:00 2001 From: EpicKnarvik97 Date: Tue, 3 Aug 2021 12:28:21 +0200 Subject: [PATCH] Increases readability a bit --- .../net/knarcraft/minecraftserverlauncher/utility/Updater.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/knarcraft/minecraftserverlauncher/utility/Updater.java b/src/main/java/net/knarcraft/minecraftserverlauncher/utility/Updater.java index 8a9941d..a44e104 100644 --- a/src/main/java/net/knarcraft/minecraftserverlauncher/utility/Updater.java +++ b/src/main/java/net/knarcraft/minecraftserverlauncher/utility/Updater.java @@ -87,7 +87,8 @@ public final class Updater { public static boolean isVersionHigher(String oldVersion, String newVersion) { String[] oldVersionParts = oldVersion.split("\\."); String[] newVersionParts = newVersion.split("\\."); - for (int i = 0; i < Math.max(oldVersionParts.length, newVersionParts.length); i++) { + int versionLength = Math.max(oldVersionParts.length, newVersionParts.length); + for (int i = 0; i < versionLength; i++) { int oldVersionNumber = oldVersionParts.length > i ? Integer.parseInt(oldVersionParts[i]) : 0; int newVersionNumber = newVersionParts.length > i ? Integer.parseInt(newVersionParts[i]) : 0; if (newVersionNumber != oldVersionNumber) {