Skip to content

Commit a8a945d

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

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

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

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* This file is part of MiniMOTD, licensed under the MIT License.
33
*
4-
* Copyright (c) 2020-2024 Jason Penilla
4+
* Copyright (c) 2020-2023 Jason Penilla
55
*
66
* Permission is hereby granted, free of charge, to any person obtaining a copy
77
* of this software and associated documentation files (the "Software"), to deal
@@ -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)