[Android] Prevent IndexOutOfBoundsException

Geoffrey Métais git at videolan.org
Wed Jun 22 12:19:27 CEST 2016


vlc-android | branch: 2.0.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Jun 22 11:16:18 2016 +0200| [5f7b03ce5b15edabac6f99ca2281aff9ebbc4ae8] | committer: Geoffrey Métais

Prevent IndexOutOfBoundsException

(cherry picked from commit 4c29c96b6727bc6b2a30757db807ca666947ba6e)

> https://code.videolan.org/videolan/vlc-android/commit/5f7b03ce5b15edabac6f99ca2281aff9ebbc4ae8
---

 .../src/org/videolan/vlc/gui/tv/browser/MusicFragment.java  | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/tv/browser/MusicFragment.java b/vlc-android/src/org/videolan/vlc/gui/tv/browser/MusicFragment.java
index cd99d5a..40566a0 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/browser/MusicFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/browser/MusicFragment.java
@@ -148,11 +148,14 @@ public class MusicFragment extends MediaLibBrowserFragment {
                     }
                 }
                 //Customize title for artist/genre browsing
-                if (mType == FILTER_ARTIST){
-                    title = title + " " + mMediaItemList.get(0).mediaList.get(0).getArtist();
-                } else if (mType == FILTER_GENRE){
-                    title = title + " " + mMediaItemList.get(0).mediaList.get(0).getGenre();
-                }
+                if (!mMediaItemList.isEmpty()) {
+                    if (mType == FILTER_ARTIST){
+                        title = title + " " + mMediaItemList.get(0).mediaList.get(0).getArtist();
+                    } else if (mType == FILTER_GENRE){
+                        title = title + " " + mMediaItemList.get(0).mediaList.get(0).getGenre();
+                    }
+                } else
+                    title = getString(R.string.app_name_full);
             } else if (CATEGORY_GENRES == mCategory){
                 title = getString(R.string.genres);
                 Collections.sort(audioList, MediaComparators.byGenre);



More information about the Android mailing list