Avoid potential NPE. Check for null first.

here
cpfeiffer 2015-11-18 23:21:56 +01:00
parent 1e6db708d2
commit 34e08f6de8
1 changed files with 1 additions and 1 deletions

View File

@ -88,10 +88,10 @@ public class FileUtils {
private static List<File> getWritableExternalFilesDirs() throws IOException {
Context context = GBApplication.getContext();
File[] dirs = context.getExternalFilesDirs(null);
List<File> result = new ArrayList<>(dirs.length);
if (dirs == null) {
throw new IOException("Unable to access external files dirs: null");
}
List<File> result = new ArrayList<>(dirs.length);
if (dirs.length == 0) {
throw new IOException("Unable to access external files dirs: 0");
}