From a1b390190e3881e6c915fd1d5873e4ce4f6485fd Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 27 Nov 2019 22:28:38 +0100 Subject: [PATCH] adding 2 more null checks --- .../simplemobiletools/gallery/pro/activities/MainActivity.kt | 2 +- .../com/simplemobiletools/gallery/pro/extensions/Context.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt index 37b9a8c46..9469474f2 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt @@ -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) { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Context.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Context.kt index 81dd0e8e3..552b47339 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Context.kt @@ -251,7 +251,7 @@ fun Context.getDirectParentSubfolders(dirs: ArrayList, 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