From 27deda05d0ad3a78f56c26df8155778d985422bb Mon Sep 17 00:00:00 2001 From: Blatzar <46196380+Blatzar@users.noreply.github.com> Date: Thu, 4 Nov 2021 17:36:12 +0100 Subject: [PATCH] fixed crash --- .../lagradost/cloudstream3/ui/settings/SettingsFragment.kt | 2 ++ .../lagradost/cloudstream3/utils/VideoDownloadManager.kt | 6 ------ 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/com/lagradost/cloudstream3/ui/settings/SettingsFragment.kt b/app/src/main/java/com/lagradost/cloudstream3/ui/settings/SettingsFragment.kt index 8a77d4b2..f342ce93 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/ui/settings/SettingsFragment.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/ui/settings/SettingsFragment.kt @@ -64,6 +64,8 @@ class SettingsFragment : PreferenceFragmentCompat() { // Open file picker private val pathPicker = registerForActivityResult(ActivityResultContracts.OpenDocumentTree()) { uri -> + // It lies, it can be null if file manager quits. + if (uri == null) return@registerForActivityResult val context = context ?: AcraApplication.context ?: return@registerForActivityResult // RW perms for the path val flags = Intent.FLAG_GRANT_READ_URI_PERMISSION or diff --git a/app/src/main/java/com/lagradost/cloudstream3/utils/VideoDownloadManager.kt b/app/src/main/java/com/lagradost/cloudstream3/utils/VideoDownloadManager.kt index a10d1652..90587b91 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/utils/VideoDownloadManager.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/utils/VideoDownloadManager.kt @@ -604,7 +604,6 @@ object VideoDownloadManager { } else { val subDir = baseFile.first?.gotoDir(folder) val rFile = subDir?.findFile(displayName) - println("RFILE ${baseFile.first?.filePath} $folder $subDir") if (rFile?.exists() != true) { fileLength = 0 if (subDir?.createFile(displayName) == null) return StreamData(ERROR_CREATE_FILE) @@ -1365,8 +1364,6 @@ object VideoDownloadManager { val info = context.getKey(KEY_DOWNLOAD_INFO, id.toString()) ?: return null val base = basePathToFile(context, info.basePath) - println("INFFOFOFOF $info ${base?.filePath} ") - if (isScopedStorage && base.isDownloadDir()) { val cr = context.contentResolver ?: return null val fileUri = @@ -1377,8 +1374,6 @@ object VideoDownloadManager { } else { val file = base?.gotoDir(info.relativePath, false)?.findFile(info.displayName) - println("ffffffile ${file?.filePath} ${file?.uri} $file ") - // val normalPath = context.getNormalPath(getFile(info.relativePath), info.displayName) // val dFile = File(normalPath) @@ -1415,7 +1410,6 @@ object VideoDownloadManager { downloadStatusEvent.invoke(Pair(id, DownloadType.IsStopped)) downloadDeleteEvent.invoke(id) val base = basePathToFile(context, info.basePath) - println("DOWNLOAD DIRRRR ----- ${base?.filePath} -------- ${info.relativePath} --------- ${info.displayName} -------- ${info.basePath} $") if (isScopedStorage && base.isDownloadDir()) { val cr = context.contentResolver ?: return false val fileUri =