From 0dba5114a1e96a338eb3681d27af9fc3ad12d4ab Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 4 Jul 2018 19:26:52 +0200 Subject: [PATCH] adding a null check at selecting directories --- .../simplemobiletools/gallery/adapters/DirectoryAdapter.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt index 6a165bdeb..e41fec139 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt @@ -436,7 +436,11 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList { val paths = HashSet(selectedPositions.size) - selectedPositions.forEach { paths.add(dirs[it].path) } + selectedPositions.forEach { + (dirs.getOrNull(it))?.apply { + paths.add(path) + } + } return paths }