From 1e6db708d20d6f8b73ec42052f9a3ee76e0d053a Mon Sep 17 00:00:00 2001 From: cpfeiffer Date: Wed, 18 Nov 2015 23:17:28 +0100 Subject: [PATCH] Fix NPE. Now that is a really crappy API in Android that returns an array with null values. closes #167 --- .../nodomain/freeyourgadget/gadgetbridge/util/FileUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/util/FileUtils.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/util/FileUtils.java index 258c8c6ef..b21f684cd 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/util/FileUtils.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/util/FileUtils.java @@ -97,7 +97,7 @@ public class FileUtils { } for (int i = 0; i < dirs.length; i++) { File dir = dirs[i]; - if (!dir.exists() && !dir.mkdirs()) { + if (dir == null || (!dir.exists() && !dir.mkdirs())) { continue; } // the first directory is also the primary external storage, i.e. the same as Environment.getExternalFilesDir()