mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2025-06-05 21:49:48 +02:00
Avoid potential NPE. Check for null first.
This commit is contained in:
@@ -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");
|
||||
}
|
||||
|
Reference in New Issue
Block a user