fixed possible NPE

This commit is contained in:
Jeremy Long
2017-03-11 13:28:21 -05:00
parent b157049a7e
commit 1d32a6012a

View File

@@ -38,6 +38,7 @@ import java.util.Properties;
* @author Jeremy Long * @author Jeremy Long
*/ */
public final class Settings { public final class Settings {
/** /**
* The logger. * The logger.
*/ */
@@ -425,7 +426,6 @@ public final class Settings {
} }
//</editor-fold> //</editor-fold>
/** /**
* Private constructor for the Settings class. This class loads the * Private constructor for the Settings class. This class loads the
* properties files. * properties files.
@@ -974,7 +974,7 @@ public final class Settings {
*/ */
public static File getDataDirectory() throws IOException { public static File getDataDirectory() throws IOException {
final File path = Settings.getDataFile(Settings.KEYS.DATA_DIRECTORY); final File path = Settings.getDataFile(Settings.KEYS.DATA_DIRECTORY);
if (path.exists() || path.mkdirs()) { if (path != null && (path.exists() || path.mkdirs())) {
return path; return path;
} }
throw new IOException(String.format("Unable to create the data directory '%s'", path.getAbsolutePath())); throw new IOException(String.format("Unable to create the data directory '%s'", path.getAbsolutePath()));