fix nullpointer when running for the first time

This commit is contained in:
yugecin 2017-04-28 22:47:28 +02:00
parent 9b3334c92b
commit 97133e24c6
2 changed files with 2 additions and 1 deletions

View File

@ -174,7 +174,7 @@ public class Configuration {
} }
private File loadDirectory(File dir, File defaultDir, String kind) { private File loadDirectory(File dir, File defaultDir, String kind) {
if (dir.exists() && dir.isDirectory()) { if (dir != null && dir.exists() && dir.isDirectory()) {
return dir; return dir;
} }
if (!defaultDir.isDirectory() && !defaultDir.mkdir()) { if (!defaultDir.isDirectory() && !defaultDir.mkdir()) {

View File

@ -50,6 +50,7 @@ public class OptionsService {
public void loadOptions() { public void loadOptions() {
// if no config file, use default settings // if no config file, use default settings
if (!config.OPTIONS_FILE.isFile()) { if (!config.OPTIONS_FILE.isFile()) {
config.loadDirectories();
saveOptions(); saveOptions();
return; return;
} }