fix: crash when playing deleted playlist in background

This commit is contained in:
Bnyro 2023-12-23 10:48:46 +01:00
parent f86eaccf95
commit 31ba48e539

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(),