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,6 +64,7 @@ class DownloadFileGenerator(
): Boolean { ): Boolean {
val meta = episodes[currentIndex + offset] val meta = episodes[currentIndex + offset]
if (meta.uri == Uri.EMPTY) {
// We do this here so that we only load it when // We do this here so that we only load it when
// we actually need it as it can be more expensive. // we actually need it as it can be more expensive.
val info = meta.id?.let { id -> val info = meta.id?.let { id ->
@ -75,6 +77,7 @@ class DownloadFileGenerator(
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
val relative = meta.relativePath ?: return true val relative = meta.relativePath ?: return true