From b11c3d03403ffa4ff8a23e3217a9e57375ea1112 Mon Sep 17 00:00:00 2001 From: Arka Prava Basu Date: Fri, 9 Nov 2018 14:46:41 +0530 Subject: [PATCH] Add files only if listFiles is non null Signed-off-by: Arka Prava Basu --- .../java/org/havenapp/main/service/RemoveDeletedFilesJob.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/havenapp/main/service/RemoveDeletedFilesJob.kt b/src/main/java/org/havenapp/main/service/RemoveDeletedFilesJob.kt index 3f67ea61..58f9b65e 100644 --- a/src/main/java/org/havenapp/main/service/RemoveDeletedFilesJob.kt +++ b/src/main/java/org/havenapp/main/service/RemoveDeletedFilesJob.kt @@ -110,7 +110,7 @@ class RemoveDeletedFilesJob: Job() { if (!storageDir.exists() || !storageDir.isDirectory) return - currentFileList.addAll(storageDir.listFiles()) + storageDir.listFiles() ?: currentFileList.addAll(storageDir.listFiles()) val subDir = storageDir.list { dir, name -> File(dir, name).isDirectory } subDir.filter { it != null }.forEach { getAllFileInStorageDir(File(storageDir, it), currentFileList) }