[Android] Fix a NPE on null cover bitmap

Ludovic Fauvet git at videolan.org
Tue Apr 15 17:13:40 CEST 2014


vlc-ports/android | branch: master | Ludovic Fauvet <etix at videolan.org> | Tue Apr 15 17:04:12 2014 +0200| [30c0a19b46bdc819070a60b8acb0c0823139c6e5] | committer: Ludovic Fauvet

Fix a NPE on null cover bitmap

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

 vlc-android/src/org/videolan/vlc/AudioService.java |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/vlc/AudioService.java b/vlc-android/src/org/videolan/vlc/AudioService.java
index 689ac93..dbce4bf 100644
--- a/vlc-android/src/org/videolan/vlc/AudioService.java
+++ b/vlc-android/src/org/videolan/vlc/AudioService.java
@@ -872,7 +872,7 @@ public class AudioService extends Service {
             editor.putLong(MediaMetadataRetriever.METADATA_KEY_DURATION, media.getLength());
             // Copy the cover bitmap because the RemonteControlClient can recycle its artwork bitmap.
             Bitmap cover = getCover();
-            editor.putBitmap(MetadataEditor.BITMAP_KEY_ARTWORK, cover.copy(cover.getConfig(), false));
+            editor.putBitmap(MetadataEditor.BITMAP_KEY_ARTWORK, ((cover != null) ? cover.copy(cover.getConfig(), false) : null));
             editor.apply();
         }
     }



More information about the Android mailing list