[Android] Prevent crash when shuffling an empty playlist
Nicolas Pomepuy
git at videolan.org
Thu Oct 17 13:38:14 UTC 2024
vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Tue Oct 8 14:52:35 2024 +0200| [6ea4fafd0f9aa32bec0b2eed9d4fd13f5cd6ce38] | committer: Duncan McNamara
Prevent crash when shuffling an empty playlist
> https://code.videolan.org/videolan/vlc-android/commit/6ea4fafd0f9aa32bec0b2eed9d4fd13f5cd6ce38
---
.../vlc-android/src/org/videolan/vlc/gui/HeaderMediaListActivity.kt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/HeaderMediaListActivity.kt b/application/vlc-android/src/org/videolan/vlc/gui/HeaderMediaListActivity.kt
index c056da4b2c..be361202b1 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/HeaderMediaListActivity.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/HeaderMediaListActivity.kt
@@ -169,7 +169,7 @@ open class HeaderMediaListActivity : AudioPlayerContainerActivity(), IEventsHand
}
binding.btnShuffle.setOnClickListener {
- viewModel.playlist?.let { MediaUtils.playTracks(this, it, SecureRandom().nextInt(min(playlist.tracksCount, MEDIALIBRARY_PAGE_SIZE)), true) }
+ viewModel.playlist?.let { if (it.tracksCount > 0) MediaUtils.playTracks(this, it, SecureRandom().nextInt(min(playlist.tracksCount, MEDIALIBRARY_PAGE_SIZE)), true) }
}
binding.btnAddPlaylist.setOnClickListener {
viewModel.playlist?.let { addToPlaylist(it.tracks.toList()) }
More information about the Android
mailing list