diff options
author | Scott Jackson <daneren2005@gmail.com> | 2014-12-27 20:08:40 -0600 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2014-12-27 20:08:40 -0600 |
commit | d92081350906e65c8f04afa5f1f4304c9ae86f1c (patch) | |
tree | d7aa55d4d7b5e3fc1b545907149497204928fbb4 | |
parent | 453a2c14a60016f8a845e60a1188395aeaff6a5d (diff) | |
download | dsub-d92081350906e65c8f04afa5f1f4304c9ae86f1c.tar.gz dsub-d92081350906e65c8f04afa5f1f4304c9ae86f1c.tar.bz2 dsub-d92081350906e65c8f04afa5f1f4304c9ae86f1c.zip |
Fix crash if album is null
-rw-r--r-- | src/github/daneren2005/dsub/util/ImageLoader.java | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/github/daneren2005/dsub/util/ImageLoader.java b/src/github/daneren2005/dsub/util/ImageLoader.java index 0342b6c9..48ff39ca 100644 --- a/src/github/daneren2005/dsub/util/ImageLoader.java +++ b/src/github/daneren2005/dsub/util/ImageLoader.java @@ -110,7 +110,16 @@ public class ImageLoader { color = COLORS[0]; } else { key = getKey(entry.getId() + "unknown", size); - color = COLORS[Math.abs(entry.getAlbum().hashCode()) % COLORS.length]; + + String hash; + if(entry.getAlbum() != null) { + hash = entry.getAlbum(); + } else if(entry.getArtist() != null) { + hash = entry.getArtist(); + } else { + hash = entry.getId(); + } + color = COLORS[Math.abs(hash.hashCode()) % COLORS.length]; } Bitmap bitmap = cache.get(key); if(bitmap == null) { |