Skip to content

Commit ea5e97e

Browse files
Lumine1909jpenilla
authored andcommitted
Fix
Fix the IndexOutOfBoundException
1 parent e495e76 commit ea5e97e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

common/src/main/java/xyz/jpenilla/minimotd/common/util/UpdateChecker.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@ public final class UpdateChecker {
5454
result.forEach(element -> versionMap.put(element.getAsJsonObject().get("tag_name").getAsString(), element.getAsJsonObject().get("html_url").getAsString()));
5555
final List<String> versionList = new LinkedList<>(versionMap.keySet());
5656
final String currentVersion = "v" + Constants.PluginMetadata.VERSION;
57+
if (versionList.isEmpty()) { // Sometimes version check will fail and get an empty list
58+
return Collections.singletonList(
59+
"Failed to check version, if this plugin work incorrectly, please check for updates manually at https://github.com/jpenilla/MiniMOTD/releases"
60+
);
61+
}
5762
if (versionList.get(0).equals(currentVersion)) {
5863
return Collections.emptyList(); // Up to date, do nothing
5964
}

0 commit comments

Comments
 (0)