Skip to content

Commit

Permalink
Fix crash on empty playlist shuffle and background playback (#3131)
Browse files Browse the repository at this point in the history
* 🐛 Fixes crash on empty playlist shuffle and background playback

---------

Co-authored-by: Bnyro <[email protected]>
  • Loading branch information
praveenrajput and Bnyro authored Feb 20, 2023
1 parent 1354a29 commit 3d8a782
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ class PlaylistFragment : BaseFragment() {
binding.bookmark.setIconResource(R.drawable.ic_shuffle)
binding.bookmark.text = getString(R.string.shuffle)
binding.bookmark.setOnClickListener {
if (playlistFeed.isEmpty()) return@setOnClickListener
val queue = playlistFeed.shuffled()
PlayingQueue.resetToDefaults()
PlayingQueue.add(*queue.toTypedArray())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class PlaylistOptionsBottomSheet(
getString(R.string.playOnBackground) -> {
runBlocking {
val playlist = PlaylistsHelper.getPlaylist(playlistId)
if (playlist.relatedStreams.isEmpty()) return@runBlocking
BackgroundHelper.playOnBackground(
context = requireContext(),
videoId = playlist.relatedStreams[0].url!!.toID(),
Expand Down

0 comments on commit 3d8a782

Please sign in to comment.