make sure some items are selected before trying to delete

This commit is contained in:
tibbi 2018-02-21 13:44:07 +01:00
parent 78ae1f1d5d
commit 403dde02fb
2 changed files with 8 additions and 0 deletions

View file

@ -239,6 +239,10 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: MutableList<Direc
} }
private fun deleteFiles() { private fun deleteFiles() {
if (selectedPositions.isEmpty()) {
return
}
val folders = ArrayList<File>(selectedPositions.size) val folders = ArrayList<File>(selectedPositions.size)
val removeFolders = ArrayList<Directory>(selectedPositions.size) val removeFolders = ArrayList<Directory>(selectedPositions.size)

View file

@ -215,6 +215,10 @@ class MediaAdapter(activity: BaseSimpleActivity, var media: MutableList<Medium>,
private fun getCurrentPath() = media[selectedPositions.first()].path private fun getCurrentPath() = media[selectedPositions.first()].path
private fun deleteFiles() { private fun deleteFiles() {
if (selectedPositions.isEmpty()) {
return
}
val fileDirItems = ArrayList<FileDirItem>(selectedPositions.size) val fileDirItems = ArrayList<FileDirItem>(selectedPositions.size)
val removeMedia = ArrayList<Medium>(selectedPositions.size) val removeMedia = ArrayList<Medium>(selectedPositions.size)