Merge pull request #5382 from Bnyro/master

fix: crash when playing deleted playlist in background
This commit is contained in:
Bnyro 2023-12-23 10:49:21 +01:00 committed by GitHub
commit ac02961cb6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -68,8 +68,12 @@ class PlaylistOptionsBottomSheet : BaseBottomSheet() {
// play the playlist in the background
R.string.playOnBackground -> {
val playlist = withContext(Dispatchers.IO) {
PlaylistsHelper.getPlaylist(playlistId)
runCatching { PlaylistsHelper.getPlaylist(playlistId) }
}.getOrElse {
context?.toastFromMainDispatcher(R.string.error)
return@setSimpleItems
}
playlist.relatedStreams.firstOrNull()?.let {
BackgroundHelper.playOnBackground(
requireContext(),