adding some crashfixes

This commit is contained in:
tibbi 2021-02-12 22:18:14 +01:00
parent 3f50700b85
commit 01da232d39
2 changed files with 10 additions and 9 deletions

View File

@ -393,10 +393,12 @@ class ItemsAdapter(activity: SimpleActivity, var listItems: MutableList<ListItem
val sourceFolder = sourceFile.toFileDirItem(activity)
activity.deleteFile(sourceFolder, true) {
listener?.refreshItems()
activity.runOnUiThread {
finishActMode()
}
}
}
}
} else {
listener?.refreshItems()
finishActMode()

View File

@ -230,22 +230,21 @@ class ItemsFragment : Fragment(), ItemOperationsListener, Breadcrumbs.Breadcrumb
private fun getRegularItemsOf(path: String, callback: (originalPath: String, items: ArrayList<ListItem>) -> Unit) {
val items = ArrayList<ListItem>()
val files = File(path).listFiles()?.filterNotNull()
if (context == null) {
if (context == null || files == null) {
callback(path, items)
return
}
val lastModifieds = context!!.getFolderLastModifieds(path)
val isSortingBySize = context!!.config.getFolderSorting(currentPath) and SORT_BY_SIZE != 0
val getProperChildCount = context!!.config.getFolderViewType(currentPath) == VIEW_TYPE_LIST
if (files != null) {
val lastModifieds = context!!.getFolderLastModifieds(path)
for (file in files) {
val fileDirItem = getFileDirItemFromFile(file, isSortingBySize, lastModifieds, getProperChildCount)
if (fileDirItem != null) {
items.add(fileDirItem)
}
}
}
callback(path, items)
}