From 77e714830763134b227baafd0874f1153255ebe7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Thu, 14 Apr 2011 06:53:25 +0200 Subject: [PATCH] =?utf8?q?Only=20add=20an=20album=20if=20it=20doesn?= =?utf8?q?=E2=80=99t=20yet=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 0abc59c..e3b33de 100644 --- a/src/main/java/net/pterodactylus/sone/data/Album.java +++ b/src/main/java/net/pterodactylus/sone/data/Album.java @@ -125,8 +125,10 @@ public class Album implements Fingerprintable { */ public void addAlbum(Album album) { Validation.begin().isNotNull("Album", album).check().isEqual("Album Owner", album.sone, sone).isEither("Old Album Parent", this.parent, null, album.parent).check(); - albums.add(album); album.setParent(this); + if (!albums.contains(album)) { + albums.add(album); + } } /** -- 2.7.4