Skip to content
Snippets Groups Projects
Commit d06a6e25 authored by akwizgran's avatar akwizgran Committed by str4d
Browse files

Check that result of File#listFiles() is not null.

parent f73f0aa4
No related branches found
No related tags found
No related merge requests found
......@@ -76,7 +76,9 @@ public class AppModule {
private volatile SecretKey key = null;
public boolean databaseExists() {
return dir.isDirectory() && dir.listFiles().length > 0;
if (!dir.isDirectory()) return false;
File[] files = dir.listFiles();
return files != null && files.length > 0;
}
public File getDatabaseDirectory() {
......
......@@ -17,7 +17,9 @@ public class TestDatabaseConfig implements DatabaseConfig {
}
public boolean databaseExists() {
return dir.isDirectory() && dir.listFiles().length > 0;
if (!dir.isDirectory()) return false;
File[] files = dir.listFiles();
return files != null && files.length > 0;
}
public File getDatabaseDirectory() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment