Don’t let a Sone add itself as friend!
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 15 Oct 2010 08:27:21 +0000 (10:27 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 15 Oct 2010 08:27:21 +0000 (10:27 +0200)
src/main/java/net/pterodactylus/sone/data/Sone.java

index 7041289..cd9239e 100644 (file)
@@ -197,7 +197,7 @@ public class Sone {
         * @return This Sone (for method chaining)
         */
        public synchronized Sone addFriend(Sone friendSone) {
-               if (friendSones.add(friendSone)) {
+               if (!friendSone.equals(this) && friendSones.add(friendSone)) {
                        modificationCounter++;
                }
                return this;