[Android] Fix potential IndexOutOfBoundsException

Geoffrey Métais git at videolan.org
Wed Dec 2 16:35:11 CET 2015


vlc-ports/android | branch: 1.7.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Dec  2 16:14:46 2015 +0100| [41139e8386c349005acc69611a88d59994a32b24] | committer: Geoffrey Métais

Fix potential IndexOutOfBoundsException

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

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

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 46cc56d..f21b940 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
@@ -322,6 +322,8 @@ public class AudioBrowserFragment extends MediaBrowserFragment implements SwipeR
         @Override
         public void onItemClick(AdapterView<?> av, View v, int p, long id) {
             ArrayList<MediaWrapper> mediaList = mArtistsAdapter.getMedias(p);
+            if (mediaList.isEmpty())
+                return;
             MainActivity activity = (MainActivity)getActivity();
             Intent i = new Intent(getActivity(), SecondaryActivity.class);
             i.putExtra("fragment", "albumsSongs");
@@ -335,6 +337,8 @@ public class AudioBrowserFragment extends MediaBrowserFragment implements SwipeR
         @Override
         public void onItemClick(AdapterView<?> av, View v, int p, long id) {
             ArrayList<MediaWrapper> mediaList = mAlbumsAdapter.getMedias(p);
+            if (mediaList.isEmpty())
+                return;
             Intent i = new Intent(getActivity(), SecondaryActivity.class);
             i.putExtra("fragment", SecondaryActivity.ALBUM);
             i.putParcelableArrayListExtra("list", mediaList);
@@ -347,6 +351,8 @@ public class AudioBrowserFragment extends MediaBrowserFragment implements SwipeR
         @Override
         public void onItemClick(AdapterView<?> av, View v, int p, long id) {
             ArrayList<MediaWrapper> mediaList = mGenresAdapter.getMedias(p);
+            if (mediaList.isEmpty())
+                return;
             Intent i = new Intent(getActivity(), SecondaryActivity.class);
             i.putExtra("fragment", SecondaryActivity.ALBUMS_SONGS);
             i.putParcelableArrayListExtra("list", mediaList);



More information about the Android mailing list