Archiviert
13
0

Make sure the plugins folder actually exists before iterating

Dieser Commit ist enthalten in:
Dan Mulloy 2016-01-09 12:31:20 -05:00
Ursprung 8e8cf54ddd
Commit 39998eedf8

Datei anzeigen

@ -501,17 +501,20 @@ public class ProtocolLibrary extends JavaPlugin {
// The plugin folder isn't always plugins/ // The plugin folder isn't always plugins/
File pluginFolder = getDataFolder().getParentFile(); File pluginFolder = getDataFolder().getParentFile();
for (File candidate : pluginFolder.listFiles()) { File[] candidates = pluginFolder.listFiles();
if (candidate.isFile() && !candidate.equals(loadedFile)) { if (candidates != null) {
Matcher match = ourPlugin.matcher(candidate.getName()); for (File candidate : pluginFolder.listFiles()) {
if (match.matches()) { if (candidate.isFile() && !candidate.equals(loadedFile)) {
MinecraftVersion version = new MinecraftVersion(match.group(1)); Matcher match = ourPlugin.matcher(candidate.getName());
if (match.matches()) {
MinecraftVersion version = new MinecraftVersion(match.group(1));
if (candidate.length() == 0) { if (candidate.length() == 0) {
// Delete and inform the user // Delete and inform the user
logger.info((candidate.delete() ? "Deleted " : "Could not delete ") + candidate); logger.info((candidate.delete() ? "Deleted " : "Could not delete ") + candidate);
} else if (newestVersion == null || newestVersion.compareTo(version) < 0) { } else if (newestVersion == null || newestVersion.compareTo(version) < 0) {
newestVersion = version; newestVersion = version;
}
} }
} }
} }