[Android] AudioService: blind fix for a NullPointerException

Edward Wang git at videolan.org
Sun Aug 26 00:08:11 CEST 2012


vlc-ports/android | branch: master | Edward Wang <edward.c.wang at compdigitec.com> | Sat Aug 25 18:07:49 2012 -0400| [d0327c929455a81178be8ad8dd1669bc721ea208] | committer: Edward Wang

AudioService: blind fix for a NullPointerException

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

 vlc-android/src/org/videolan/vlc/AudioService.java |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/AudioService.java b/vlc-android/src/org/videolan/vlc/AudioService.java
index 16559fe..f8f3c27 100644
--- a/vlc-android/src/org/videolan/vlc/AudioService.java
+++ b/vlc-android/src/org/videolan/vlc/AudioService.java
@@ -471,9 +471,11 @@ public class AudioService extends Service {
                 int titleColumn = cursor.getColumnIndex(android.provider.MediaStore.Audio.Albums.ALBUM_ART);
                 String albumArt = cursor.getString(titleColumn);
                 cursor.close();
-                Bitmap b = BitmapFactory.decodeFile(albumArt);
-                if (b != null)
-                    return b;
+                if(albumArt != null) { // could be null (no album art stored)
+                    Bitmap b = BitmapFactory.decodeFile(albumArt);
+                    if (b != null)
+                        return b;
+                }
             }
 
             //cover not in MediaStore, trying vlc



More information about the Android mailing list