mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-26 22:47:59 +01:00
adding some null checks at deleting files/folders
This commit is contained in:
parent
902bdb0255
commit
bb8acad55e
2 changed files with 12 additions and 10 deletions
|
@ -380,17 +380,19 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList<Directo
|
|||
|
||||
activity.handleSAFDialog(SAFPath) {
|
||||
selectedPositions.sortedDescending().forEach {
|
||||
val directory = dirs[it]
|
||||
if (directory.areFavorites() || directory.isRecycleBin()) {
|
||||
if (selectedPositions.size == 1) {
|
||||
finishActMode()
|
||||
val directory = dirs.getOrNull(it)
|
||||
if (directory != null) {
|
||||
if (directory.areFavorites() || directory.isRecycleBin()) {
|
||||
if (selectedPositions.size == 1) {
|
||||
finishActMode()
|
||||
} else {
|
||||
selectedPositions.remove(it)
|
||||
toggleItemSelection(false, it)
|
||||
}
|
||||
} else {
|
||||
selectedPositions.remove(it)
|
||||
toggleItemSelection(false, it)
|
||||
folders.add(File(directory.path))
|
||||
removeFolders.add(directory)
|
||||
}
|
||||
} else {
|
||||
folders.add(File(directory.path))
|
||||
removeFolders.add(directory)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -316,7 +316,7 @@ class MediaAdapter(activity: BaseSimpleActivity, var media: MutableList<Thumbnai
|
|||
val SAFPath = (media[selectedPositions.first()] as Medium).path
|
||||
activity.handleSAFDialog(SAFPath) {
|
||||
selectedPositions.sortedDescending().forEach {
|
||||
val thumbnailItem = media[it]
|
||||
val thumbnailItem = media.getOrNull(it)
|
||||
if (thumbnailItem is Medium) {
|
||||
fileDirItems.add(FileDirItem(thumbnailItem.path, thumbnailItem.name))
|
||||
removeMedia.add(thumbnailItem)
|
||||
|
|
Loading…
Reference in a new issue