[Android] AudioUtil: don't query cover if album is null

Thomas Guillem git at videolan.org
Wed Dec 31 10:47:52 CET 2014


vlc-ports/android | branch: master | Thomas Guillem <thomas at gllm.fr> | Wed Dec 31 10:29:26 2014 +0100| [8dbea4ac2a568cde3b347f3c5fed364daaabea64] | committer: Thomas Guillem

AudioUtil: don't query cover if album is null

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

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

diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioUtil.java b/vlc-android/src/org/videolan/vlc/gui/audio/AudioUtil.java
index 37f1f8e..bfd3edb 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioUtil.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioUtil.java
@@ -153,13 +153,16 @@ public class AudioUtil {
     }
 
     private static String getCoverFromMediaStore(Context context, Media media) {
+        final String album = media.getAlbum();
+        if (album == null)
+            return null;
         ContentResolver contentResolver = context.getContentResolver();
         Uri uri = android.provider.MediaStore.Audio.Albums.EXTERNAL_CONTENT_URI;
         Cursor cursor = contentResolver.query(uri, new String[] {
                        MediaStore.Audio.Albums.ALBUM,
                        MediaStore.Audio.Albums.ALBUM_ART },
                        MediaStore.Audio.Albums.ALBUM + " LIKE ?",
-                       new String[] { media.getAlbum() }, null);
+                       new String[] { album }, null);
         if (cursor == null) {
             // do nothing
         } else if (!cursor.moveToFirst()) {



More information about the Android mailing list