X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fdata%2FSone.java;h=dbe1b359938ab9a84612d76a80ce4381ed0f5b61;hb=8d298562a71682e0bbcdc311e741e00f85490a7d;hp=33b97a071477b3d94220ad37a279874679357ffd;hpb=b2d188a64334a455dd6806ec89f0c85c9885d27d;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/data/Sone.java b/src/main/java/net/pterodactylus/sone/data/Sone.java index 33b97a0..dbe1b35 100644 --- a/src/main/java/net/pterodactylus/sone/data/Sone.java +++ b/src/main/java/net/pterodactylus/sone/data/Sone.java @@ -217,13 +217,14 @@ public class Sone { } /** - * Adds the given post to this Sone. + * Adds the given post to this Sone. The post will not be added if its + * {@link Post#getSone() Sone} is not this Sone. * * @param post * The post to add */ public synchronized void addPost(Post post) { - if (posts.add(post)) { + if (post.getSone().equals(this) && posts.add(post)) { modificationCounter++; } } @@ -235,7 +236,7 @@ public class Sone { * The post to remove */ public synchronized void removePost(Post post) { - if (posts.remove(post)) { + if (post.getSone().equals(this) && posts.remove(post)) { modificationCounter++; } }