Add Uri.EMPTY check

This commit is contained in:
Luna712 2024-07-31 11:11:13 -06:00 committed by GitHub
parent 4a8a5835ef
commit 147447bed4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,5 +1,6 @@
package com.lagradost.cloudstream3.ui.player package com.lagradost.cloudstream3.ui.player
import android.net.Uri
import com.lagradost.cloudstream3.AcraApplication.Companion.context import com.lagradost.cloudstream3.AcraApplication.Companion.context
import com.lagradost.cloudstream3.CommonActivity.activity import com.lagradost.cloudstream3.CommonActivity.activity
import com.lagradost.cloudstream3.R import com.lagradost.cloudstream3.R
@ -63,17 +64,19 @@ class DownloadFileGenerator(
): Boolean { ): Boolean {
val meta = episodes[currentIndex + offset] val meta = episodes[currentIndex + offset]
// We do this here so that we only load it when if (meta.uri == Uri.EMPTY) {
// we actually need it as it can be more expensive. // We do this here so that we only load it when
val info = meta.id?.let { id -> // we actually need it as it can be more expensive.
activity?.let { act -> val info = meta.id?.let { id ->
getDownloadFileInfoAndUpdateSettings(act, id) activity?.let { act ->
getDownloadFileInfoAndUpdateSettings(act, id)
}
} }
}
if (info != null) { if (info != null) {
val newMeta = meta.copy(uri = info.path) val newMeta = meta.copy(uri = info.path)
callback(null to newMeta) callback(null to newMeta)
} else callback(null to meta)
} else callback(null to meta) } else callback(null to meta)
val ctx = context ?: return true val ctx = context ?: return true