diff --git a/src/main/java/com/gmail/nossr50/util/UpdateChecker.java b/src/main/java/com/gmail/nossr50/util/UpdateChecker.java index ea57f3ea9..3ff13d750 100644 --- a/src/main/java/com/gmail/nossr50/util/UpdateChecker.java +++ b/src/main/java/com/gmail/nossr50/util/UpdateChecker.java @@ -43,12 +43,18 @@ public class UpdateChecker { jo = (JSONObject) jo.get("versions"); newVersion = (String) jo.get("version"); - String[] oldTokens = version.replaceAll("(?i)(-)(.+?)(-)", "").split("[.]|[b]"); - String[] newTokens = newVersion.replaceAll("(?i)(-)(.+?)(-)", "").split("[.]|[b]"); + String[] oldTokens = version.replaceAll("(?i)(-)(.+?)(-)", "-").split("[.]|-b"); + String[] newTokens = newVersion.replaceAll("(?i)(-)(.+?)(-)", "-").split("[.]|-b"); for (int i = 0; i < 4; i++) { Integer newVer = Integer.parseInt(newTokens[i]); - Integer oldVer = Integer.parseInt(oldTokens[i]); + Integer oldVer; + try { + oldVer = Integer.parseInt(oldTokens[i]); + } + catch (NumberFormatException e) { + oldVer = 0; + } if (oldVer < newVer) { isr.close(); return true;