1
0
mirror of https://github.com/SKCraft/Launcher.git synced 2025-01-20 21:21:19 +01:00

Check directories exist before trying to walk them

This commit is contained in:
Henry Le Grys 2021-03-29 13:32:45 +01:00
parent 652d6bf5ec
commit 43ca90f74d
2 changed files with 10 additions and 2 deletions

View File

@ -285,7 +285,11 @@ public class CurseModsDialog extends JDialog {
PackModScanner scanner = new PackModScanner(mapper);
ListenableFuture<?> future = ctx.getExecutor().submit(() -> {
scanner.walk(new File(pack.getDirectory(), "cursemods"));
File target = new File(pack.getDirectory(), "cursemods");
if (target.isDirectory()) {
scanner.walk(target);
}
return null;
});

View File

@ -44,7 +44,11 @@ public class Creator {
// Load plugins
CreatorPluginLoader pluginLoader = new CreatorPluginLoader();
try {
pluginLoader.walk(new File(dataDir, "plugins"));
File pluginsDir = new File(dataDir, "plugins");
if (pluginsDir.isDirectory()) {
pluginLoader.walk(pluginsDir);
}
} catch (IOException e) {
log.severe("Could not walk plugin directory, plugins have not been loaded");
}