mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-28 16:00:31 +05:30
fix: crash when videoId is unitialized
This commit is contained in:
parent
3d7cde97bc
commit
1dcc408c85
@ -307,6 +307,8 @@ abstract class AbstractPlayerService : MediaLibraryService(), MediaLibrarySessio
|
|||||||
super.onDestroy()
|
super.onDestroy()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun isVideoIdInitialized() = this::videoId.isInitialized
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stop the service when app is removed from the task manager.
|
* Stop the service when app is removed from the task manager.
|
||||||
*/
|
*/
|
||||||
|
@ -84,6 +84,8 @@ open class OfflinePlayerService : AbstractPlayerService() {
|
|||||||
* Attempt to start an audio player with the given download items
|
* Attempt to start an audio player with the given download items
|
||||||
*/
|
*/
|
||||||
override suspend fun startPlayback() {
|
override suspend fun startPlayback() {
|
||||||
|
if (!isVideoIdInitialized()) return
|
||||||
|
|
||||||
val downloadWithItems = withContext(Dispatchers.IO) {
|
val downloadWithItems = withContext(Dispatchers.IO) {
|
||||||
Database.downloadDao().findById(videoId)
|
Database.downloadDao().findById(videoId)
|
||||||
}!!
|
}!!
|
||||||
|
Loading…
x
Reference in New Issue
Block a user