Skip to content

Commit

Permalink
Fix crash when listfiles returns null (getodk#2424)
Browse files Browse the repository at this point in the history
  • Loading branch information
grzesiek2010 authored and lognaturel committed Jul 26, 2018
1 parent 1034d1d commit 570215f
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -194,13 +194,15 @@ private boolean useOfflineBasemapIfAvailable(String basemap) {
return false;
}

public static String[] getOfflineLayerList() {
private static String[] getOfflineLayerList() {
File[] files = new File(Collect.OFFLINE_LAYERS).listFiles();
ArrayList<String> results = new ArrayList<>();
results.add(NO_FOLDER_KEY);
for (File f : files) {
if (f.isDirectory() && !f.isHidden()) {
results.add(f.getName());
if (files != null) {
for (File f : files) {
if (f.isDirectory() && !f.isHidden()) {
results.add(f.getName());
}
}
}
return results.toArray(new String[0]);
Expand Down

0 comments on commit 570215f

Please sign in to comment.