1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-06-29 16:26:18 +02:00

Avoid potential NPE. Check for null first.

This commit is contained in:
cpfeiffer 2015-11-18 23:21:56 +01:00
parent 1e6db708d2
commit 34e08f6de8

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");
}