[Android] UI : Fix a IllegalArgumentException

Alexandre Perraud git at videolan.org
Wed Mar 11 19:05:41 CET 2015


vlc-ports/android | branch: master | Alexandre Perraud <4leyx4ndre at gmail.com> | Wed Mar 11 19:04:54 2015 +0100| [780ae0afbb2503124f7ab1c16420cf85acb58610] | committer: Alexandre Perraud

UI : Fix a IllegalArgumentException

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=780ae0afbb2503124f7ab1c16420cf85acb58610
---

 .../src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java b/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
index ea7d474..2f3a4f7 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
@@ -437,10 +437,12 @@ public class AudioBrowserFragment extends BrowserFragment implements SwipeRefres
     public void onFabPlayAllClick(View view) {
         List<String> medias = new ArrayList<String>();
         mSongsAdapter.getListWithPosition(medias, 0);
-        Random rand = new Random();
-        int randomSong = rand.nextInt(mSongsAdapter.getCount());
-        mAudioController.load(medias, randomSong);
-        mAudioController.shuffle();
+        if (mSongsAdapter.getCount() > 0) {
+            Random rand = new Random();
+            int randomSong = rand.nextInt(mSongsAdapter.getCount());
+            mAudioController.load(medias, randomSong);
+            mAudioController.shuffle();
+        }
     }
 
     public void setFabPlayShuffleAllVisibility() {



More information about the Android mailing list