fixed crash

This commit is contained in:
Blatzar 2021-11-04 17:36:12 +01:00
parent a941f71e90
commit 27deda05d0
2 changed files with 2 additions and 6 deletions

View file

@ -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

View file

@ -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<DownloadedFileInfo>(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 =