From 8ded406fabed389e0f9dc304232f2ab7f3cd65d7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Fri, 23 Sep 2011 11:42:18 +0200 Subject: [PATCH] Return an image if an invalid album image ID is set. --- src/main/java/net/pterodactylus/sone/data/Album.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/pterodactylus/sone/data/Album.java b/src/main/java/net/pterodactylus/sone/data/Album.java index ab5822b..88029e1 100644 --- a/src/main/java/net/pterodactylus/sone/data/Album.java +++ b/src/main/java/net/pterodactylus/sone/data/Album.java @@ -25,6 +25,7 @@ import java.util.UUID; import net.pterodactylus.util.collection.Mapper; import net.pterodactylus.util.collection.Mappers; +import net.pterodactylus.util.object.Default; import net.pterodactylus.util.validation.Validation; /** @@ -251,7 +252,7 @@ public class Album implements Fingerprintable { if (albumImage == null) { return null; } - return images.get(albumImage); + return Default.forNull(images.get(albumImage), images.values().iterator().next()); } /** -- 2.7.4