From: David ‘Bombe’ Roden Date: Thu, 14 Apr 2011 04:53:37 +0000 (+0200) Subject: Remove image from previous album, if set. X-Git-Tag: 0.7^2~2^2~70 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=356a84e5ec2bb0936b7d1cdc635f7f051788da6a;p=Sone.git Remove image from previous album, if set. --- diff --git a/src/main/java/net/pterodactylus/sone/data/Album.java b/src/main/java/net/pterodactylus/sone/data/Album.java index e3b33de..20862a4 100644 --- a/src/main/java/net/pterodactylus/sone/data/Album.java +++ b/src/main/java/net/pterodactylus/sone/data/Album.java @@ -160,6 +160,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(); + if (image.getAlbum() != null) { + image.getAlbum().removeImage(image); + } image.setAlbum(this); if (!images.contains(image)) { images.add(image);