[Android] AudioBrowserListAdapter: fix crash on blank and spaces-only titles

Edward Wang git at videolan.org
Wed Jun 11 22:50:06 CEST 2014


vlc-ports/android | branch: master | Edward Wang <edward.c.wang at compdigitec.com> | Wed Jun 11 16:47:27 2014 -0400| [bc86a5e1eccbebf45063ff5acad5c458ecf189f8] | committer: Edward Wang

AudioBrowserListAdapter: fix crash on blank and spaces-only titles

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

 .../src/org/videolan/vlc/gui/audio/AudioBrowserListAdapter.java  |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserListAdapter.java b/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserListAdapter.java
index 5ee920a..1b27044 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserListAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserListAdapter.java
@@ -128,7 +128,11 @@ public class AudioBrowserListAdapter extends BaseAdapter implements SectionIndex
 
         for (int i = 0; i < mItems.size(); ++i) {
             String title = mItems.get(i).mTitle;
-            char firstChar = title.toUpperCase(Locale.ENGLISH).charAt(0);
+            char firstChar;
+            if(title.length() > 0)
+                firstChar = title.toUpperCase(Locale.ENGLISH).charAt(0);
+            else
+                firstChar = '#'; // Blank / spaces-only song title.
 
             if (Character.isLetter(firstChar)) {
                 if (firstSeparator || firstChar != prevFirstChar) {



More information about the Android mailing list