From: David ‘Bombe’ Roden Date: Wed, 13 Apr 2011 18:33:08 +0000 (+0200) Subject: Only add an image if it doesn’t already exist. X-Git-Tag: 0.7^2~2^2~77 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=c3acd80a6f7f0b4c7f8758056baf68f8bc84c30a;p=Sone.git Only add an image if it doesn’t already exist. --- 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); + } } /**