Fix identity checking.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 15 Dec 2010 04:42:38 +0000 (05:42 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 15 Dec 2010 04:42:38 +0000 (05:42 +0100)
src/main/java/net/pterodactylus/sone/freenet/wot/IdentityManager.java

index dbf4206..aac5cd8 100644 (file)
@@ -204,15 +204,15 @@ public class IdentityManager extends AbstractService {
                                        }
 
                                        /* find new identities. */
-                                       for (Identity currentIdentity : currentIdentities.get(ownIdentities).values()) {
-                                               if (!oldIdentities.containsKey(currentIdentity.getId())) {
+                                       for (Identity currentIdentity : currentIdentities.get(ownIdentity).values()) {
+                                               if (!oldIdentities.containsKey(ownIdentity) || !oldIdentities.get(ownIdentity).containsKey(currentIdentity.getId())) {
                                                        identityListenerManager.fireIdentityAdded(ownIdentity, currentIdentity);
                                                }
                                        }
 
                                        /* find removed identities. */
                                        if (oldIdentities.containsKey(ownIdentity)) {
-                                               for (Identity oldIdentity : oldIdentities.get(ownIdentities).values()) {
+                                               for (Identity oldIdentity : oldIdentities.get(ownIdentity).values()) {
                                                        if (!currentIdentities.containsKey(oldIdentity.getId())) {
                                                                identityListenerManager.fireIdentityRemoved(ownIdentity, oldIdentity);
                                                        }