mirror of
https://github.com/aniyomiorg/aniyomi.git
synced 2024-11-22 21:02:16 +03:00
fix(player): Fix infinite loop in empty video lists (#1168)
Co-authored-by: Secozzi <49240133+Secozzi@users.noreply.github.com>
This commit is contained in:
parent
418137c74e
commit
c962b2894e
1 changed files with 7 additions and 1 deletions
|
@ -248,7 +248,13 @@ class PlayerViewModel(
|
|||
|
||||
val currentEp = currentEpisode ?: throw Exception("No episode loaded.")
|
||||
|
||||
currentVideoList = EpisodeLoader.getLinks(currentEp.toDomainEpisode()!!, anime, source).asFlow().first()
|
||||
EpisodeLoader.getLinks(currentEp.toDomainEpisode()!!, anime, source).asFlow().first()
|
||||
.takeIf { it.isNotEmpty() }
|
||||
?.also { currentVideoList = it }
|
||||
?: run {
|
||||
currentVideoList = null
|
||||
throw Exception("Video list is empty.")
|
||||
}
|
||||
savedEpisodeId = currentEp.id!!
|
||||
|
||||
Pair(currentVideoList, Result.success(true))
|
||||
|
|
Loading…
Reference in a new issue