X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fdata%2FAlbum.java;h=5d4eeb7f0c0a281201260f862a87a36e293ea801;hb=c3acd80a6f7f0b4c7f8758056baf68f8bc84c30a;hp=d7df84571084e3521d02920bd273ec4f388e5c7b;hpb=147ca6215b8c951ad46e56f919c077e6c0f66ee2;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/data/Album.java b/src/main/java/net/pterodactylus/sone/data/Album.java index d7df845..5d4eeb7 100644 --- a/src/main/java/net/pterodactylus/sone/data/Album.java +++ b/src/main/java/net/pterodactylus/sone/data/Album.java @@ -103,7 +103,7 @@ public class Album implements Fingerprintable { * @return This album */ public Album setSone(Sone sone) { - Validation.begin().isNull("Current Album Owner", this.sone).isNotNull("New Album Owner", sone).check(); + Validation.begin().isNotNull("New Album Owner", sone).check(); this.sone = sone; return this; } @@ -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); + } } /** @@ -298,7 +300,9 @@ public class Album implements Fingerprintable { /* add images. */ fingerprint.append("Images("); for (Image image : images) { - fingerprint.append(image.getFingerprint()); + if (image.isInserted()) { + fingerprint.append(image.getFingerprint()); + } } fingerprint.append(')');