From 25b31eb5a775662cb936e47c7f6c458bbe4742c4 Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 19 May 2017 20:57:58 +0200 Subject: [PATCH] adding a null check at deleting files --- .../com/simplemobiletools/gallery/adapters/MediaAdapter.kt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt index f2f896a1d..fb2a6e2d9 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt @@ -230,6 +230,9 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList, private fun getCurrentFile() = File(media[selectedPositions.first()].path) private fun deleteFiles() { + if (selectedPositions.isEmpty()) + return + val files = ArrayList(selectedPositions.size) val removeMedia = ArrayList(selectedPositions.size)