Only add an image if it doesn’t already exist.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 13 Apr 2011 18:33:08 +0000 (20:33 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 13 Apr 2011 18:33:08 +0000 (20:33 +0200)
src/main/java/net/pterodactylus/sone/data/Album.java

index 86f2c59..5d4eeb7 100644 (file)
@@ -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);
+               }
        }
 
        /**