Skip to content

Commit 01da232

Browse files
committed
adding some crashfixes
1 parent 3f50700 commit 01da232

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

app/src/main/kotlin/com/simplemobiletools/filemanager/pro/adapters/ItemsAdapter.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,9 @@ class ItemsAdapter(activity: SimpleActivity, var listItems: MutableList<ListItem
393393
val sourceFolder = sourceFile.toFileDirItem(activity)
394394
activity.deleteFile(sourceFolder, true) {
395395
listener?.refreshItems()
396-
finishActMode()
396+
activity.runOnUiThread {
397+
finishActMode()
398+
}
397399
}
398400
}
399401
}

app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/ItemsFragment.kt

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -230,20 +230,19 @@ class ItemsFragment : Fragment(), ItemOperationsListener, Breadcrumbs.Breadcrumb
230230
private fun getRegularItemsOf(path: String, callback: (originalPath: String, items: ArrayList<ListItem>) -> Unit) {
231231
val items = ArrayList<ListItem>()
232232
val files = File(path).listFiles()?.filterNotNull()
233-
if (context == null) {
233+
if (context == null || files == null) {
234234
callback(path, items)
235235
return
236236
}
237237

238-
val lastModifieds = context!!.getFolderLastModifieds(path)
239238
val isSortingBySize = context!!.config.getFolderSorting(currentPath) and SORT_BY_SIZE != 0
240239
val getProperChildCount = context!!.config.getFolderViewType(currentPath) == VIEW_TYPE_LIST
241-
if (files != null) {
242-
for (file in files) {
243-
val fileDirItem = getFileDirItemFromFile(file, isSortingBySize, lastModifieds, getProperChildCount)
244-
if (fileDirItem != null) {
245-
items.add(fileDirItem)
246-
}
240+
val lastModifieds = context!!.getFolderLastModifieds(path)
241+
242+
for (file in files) {
243+
val fileDirItem = getFileDirItemFromFile(file, isSortingBySize, lastModifieds, getProperChildCount)
244+
if (fileDirItem != null) {
245+
items.add(fileDirItem)
247246
}
248247
}
249248

0 commit comments

Comments
 (0)