add some array size checks at deleting from media/directory view
This commit is contained in:
parent
6e1f56f864
commit
ae3555b1c5
2 changed files with 12 additions and 5 deletions
|
@ -297,11 +297,13 @@ class DirectoryAdapter(val activity: SimpleActivity, var dirs: MutableList<Direc
|
|||
|
||||
activity.handleSAFDialog(File(needPermissionForPath)) {
|
||||
selectedPositions.sortedDescending().forEach {
|
||||
val directory = dirs[it]
|
||||
folders.add(File(directory.path))
|
||||
removeFolders.add(directory)
|
||||
notifyItemRemoved(it)
|
||||
itemViews.put(it, null)
|
||||
if (dirs.size > it) {
|
||||
val directory = dirs[it]
|
||||
folders.add(File(directory.path))
|
||||
removeFolders.add(directory)
|
||||
notifyItemRemoved(it)
|
||||
itemViews.put(it, null)
|
||||
}
|
||||
}
|
||||
|
||||
dirs.removeAll(removeFolders)
|
||||
|
|
|
@ -232,6 +232,11 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList<Medium>,
|
|||
val files = ArrayList<File>(selectedPositions.size)
|
||||
val removeMedia = ArrayList<Medium>(selectedPositions.size)
|
||||
|
||||
if (media.size <= selectedPositions.first()) {
|
||||
actMode?.finish()
|
||||
return
|
||||
}
|
||||
|
||||
activity.handleSAFDialog(File(media[selectedPositions.first()].path)) {
|
||||
selectedPositions.sortedDescending().forEach {
|
||||
val medium = media[it]
|
||||
|
|
Loading…
Reference in a new issue