diff options
author | Scott Jackson <daneren2005@gmail.com> | 2015-01-18 15:00:23 -0800 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2015-01-18 15:00:23 -0800 |
commit | 3422edac972bbc3c9aa8da10b2c7066c61cc714b (patch) | |
tree | 5fa3733e23e40e856e8c4cf48da26323133363e0 /src | |
parent | ff394f3e0c0c35c607d0c97ab6a22c209c9254e8 (diff) | |
download | dsub-3422edac972bbc3c9aa8da10b2c7066c61cc714b.tar.gz dsub-3422edac972bbc3c9aa8da10b2c7066c61cc714b.tar.bz2 dsub-3422edac972bbc3c9aa8da10b2c7066c61cc714b.zip |
Fix crash if both artist info url is null and cover art id is null
Diffstat (limited to 'src')
-rw-r--r-- | src/github/daneren2005/dsub/util/ImageLoader.java | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/github/daneren2005/dsub/util/ImageLoader.java b/src/github/daneren2005/dsub/util/ImageLoader.java index 3d554496..97c7f626 100644 --- a/src/github/daneren2005/dsub/util/ImageLoader.java +++ b/src/github/daneren2005/dsub/util/ImageLoader.java @@ -453,14 +453,20 @@ public class ImageLoader { subTask = new ViewUrlTask(mContext, mView, url, mSize) { @Override protected void failedToDownload() { - new ViewImageTask(mContext, mEntry, mSize, mSaveSize, mIsNowPlaying, mView, mCrossfade).execute(); + // Call loadImage so we can take advantage of all of it's logic checks + loadImage(mView, mEntry, mSize == imageSizeLarge, mCrossfade); // Delete subTask so it doesn't get called in done subTask = null; } }; - } else { + } else if(mEntry != null && mEntry.getCoverArt() != null) { subTask = new ViewImageTask(mContext, mEntry, mSize, mSaveSize, mIsNowPlaying, mView, mCrossfade); + } else { + // If entry is null as well, we need to just set as a blank image + Bitmap bitmap = getUnknownImage(mEntry, mSize); + mDrawable = Util.createDrawableFromBitmap(mContext, bitmap); + return null; } // Execute whichever way we decided to go @@ -472,6 +478,8 @@ public class ImageLoader { public void done(Void result) { if(subTask != null) { subTask.done(result); + } else if(mDrawable != null) { + setImage(mView, mDrawable, mCrossfade); } } } |