From 403dde02fb9d5bba70b5985d9567877208fe3395 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 21 Feb 2018 13:44:07 +0100 Subject: [PATCH] make sure some items are selected before trying to delete --- .../simplemobiletools/gallery/adapters/DirectoryAdapter.kt | 4 ++++ .../com/simplemobiletools/gallery/adapters/MediaAdapter.kt | 4 ++++ 2 files changed, 8 insertions(+) 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 cc3bde953..91d11445d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt @@ -239,6 +239,10 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: MutableList(selectedPositions.size) val removeFolders = ArrayList(selectedPositions.size) 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 7c599a9b0..4a7c2a5c2 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt @@ -215,6 +215,10 @@ class MediaAdapter(activity: BaseSimpleActivity, var media: MutableList, private fun getCurrentPath() = media[selectedPositions.first()].path private fun deleteFiles() { + if (selectedPositions.isEmpty()) { + return + } + val fileDirItems = ArrayList(selectedPositions.size) val removeMedia = ArrayList(selectedPositions.size)