From c3acd80a6f7f0b4c7f8758056baf68f8bc84c30a Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Wed, 13 Apr 2011 20:33:08 +0200 Subject: [PATCH] =?utf8?q?Only=20add=20an=20image=20if=20it=20doesn?= =?utf8?q?=E2=80=99t=20already=20exist.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/main/java/net/pterodactylus/sone/data/Album.java | 4 +++- 1 file changed, 3 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 86f2c59..5d4eeb7 100644 --- a/src/main/java/net/pterodactylus/sone/data/Album.java +++ b/src/main/java/net/pterodactylus/sone/data/Album.java @@ -159,7 +159,9 @@ public class Album implements Fingerprintable { public void addImage(Image image) { Validation.begin().isNotNull("Image", image).check().isNotNull("Image Owner", image.getSone()).check().isEqual("Image Owner", image.getSone(), sone).check(); image.setAlbum(this); - images.add(image); + if (!images.contains(image)) { + images.add(image); + } } /** -- 2.7.4