From 0d61293a10637ddd1bcbab50c9f9a2bfc4417d8b Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 9 Jul 2017 09:45:39 +0200 Subject: [PATCH] small edit to fetching children --- .../filemanager/fragments/ItemsFragment.kt | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/fragments/ItemsFragment.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/fragments/ItemsFragment.kt index 05003223..17a4c208 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/fragments/ItemsFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/fragments/ItemsFragment.kt @@ -162,15 +162,13 @@ class ItemsFragment : Fragment(), ItemsAdapter.ItemOperationsListener { } private fun getChildren(file: File): Int { - var fileList = file.list() - if (fileList == null) - return 0 + val fileList: Array? = file.list() ?: return 0 if (file.isDirectory) { return if (mShowHidden) { - fileList.size + fileList!!.size } else { - fileList.count { fileName -> fileName[0] != '.' } + fileList!!.count { fileName -> fileName[0] != '.' } } } return 0