From 392b54035b8e6cbd780a7e1b67f9cf4baa3b5302 Mon Sep 17 00:00:00 2001 From: Fenny Fatal Date: Sun, 21 Jul 2013 21:20:16 -0600 Subject: Bandaid Fix so we don't crash on android 4.3. --- .../github/daneren2005/dsub/util/ImageLoader.java | 28 +++++++++++++--------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/subsonic-android/src/github/daneren2005/dsub/util/ImageLoader.java b/subsonic-android/src/github/daneren2005/dsub/util/ImageLoader.java index f84116f7..782d74d6 100644 --- a/subsonic-android/src/github/daneren2005/dsub/util/ImageLoader.java +++ b/subsonic-android/src/github/daneren2005/dsub/util/ImageLoader.java @@ -183,17 +183,23 @@ public class ImageLoader implements Runnable { } } } - - private void setImage(RemoteControlClient remoteControl, Drawable drawable) { - if(remoteControl != null && drawable != null) { - Bitmap origBitmap = ((BitmapDrawable)drawable).getBitmap(); - remoteControl.editMetadata(false) - .putBitmap( - RemoteControlClient.MetadataEditor.BITMAP_KEY_ARTWORK, - origBitmap) - .apply(); - } - } + + private void setImage(RemoteControlClient remoteControl, Drawable drawable) { + if(remoteControl != null && drawable != null) { + Bitmap origBitmap = ((BitmapDrawable)drawable).getBitmap(); + if ( origBitmap != null && !origBitmap.isRecycled()) { + remoteControl.editMetadata(false) + .putBitmap( + RemoteControlClient.MetadataEditor.BITMAP_KEY_ARTWORK, + origBitmap) + .apply(); + } else { + remoteControl.editMetadata(true) + .putBitmap(RemoteControlClient.MetadataEditor.BITMAP_KEY_ARTWORK, null) + .apply(); + } + } + } private void setUnknownImage(View view, boolean large) { if (large) { -- cgit v1.2.3