From: David ‘Bombe’ Roden Date: Thu, 14 Apr 2011 04:53:25 +0000 (+0200) Subject: Only add an album if it doesn’t yet exist. X-Git-Tag: 0.7^2~2^2~71 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=77e714830763134b227baafd0874f1153255ebe7;p=Sone.git Only add an album if it doesn’t yet exist. --- 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); + } } /**