adding 2 more null checks

This commit is contained in:
tibbi 2019-11-27 22:28:38 +01:00
parent 1d0f129e85
commit a1b390190e
2 changed files with 2 additions and 2 deletions

View file

@ -1114,7 +1114,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
} else if (it.path != config.tempFolderPath) {
val children = if (isPathOnOTG(it.path)) getOTGFolderChildrenNames(it.path) else File(it.path).list()?.asList()
val hasMediaFile = children?.any {
it?.isMediaFile() == true || (File(it).isDirectory && it?.startsWith("img_", true) == true)
it?.isMediaFile() == true || (File(it!!).isDirectory && it.startsWith("img_", true))
} ?: false
if (!hasMediaFile) {

View file

@ -251,7 +251,7 @@ fun Context.getDirectParentSubfolders(dirs: ArrayList<Directory>, currentPathPre
// /storage/emulated/0/Pictures/Screenshots,
// but /storage/emulated/0/Pictures is empty, still Pictures with the first folders thumbnails and proper other info
val parent = File(path).parent
if (!folders.contains(parent) && dirs.none { it.path == parent }) {
if (parent != null && !folders.contains(parent) && dirs.none { it.path == parent }) {
currentPaths.add(parent)
val isSortingAscending = config.sorting and SORT_DESCENDING == 0
val subDirs = dirs.filter { File(it.path).parent.equals(File(path).parent, true) } as ArrayList<Directory>