Prevent exception if own identity does not have the correct context.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 15 Sep 2011 14:34:19 +0000 (16:34 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 15 Sep 2011 14:34:19 +0000 (16:34 +0200)
Not having the correct context is the only way the trusted identities can
be null; with the correct context at least an empty set would be returned.

src/main/java/net/pterodactylus/wotns/freenet/wot/IdentityManager.java

index e9107fe..eefb372 100644 (file)
@@ -28,6 +28,7 @@ import java.util.logging.Logger;
 
 import net.pterodactylus.util.collection.SetBuilder;
 import net.pterodactylus.util.logging.Logging;
+import net.pterodactylus.util.object.Default;
 import net.pterodactylus.util.service.AbstractService;
 import net.pterodactylus.wotns.freenet.plugin.PluginException;
 
@@ -177,7 +178,7 @@ public class IdentityManager extends AbstractService {
                        identities.add(ownIdentity);
                }
                synchronized (syncObject) {
-                       identities.addAll(currentTrustedIdentities.get(ownIdentity));
+                       identities.addAll(Default.forNull(currentTrustedIdentities.get(ownIdentity), Collections.<Identity> emptySet()));
                }
                return identities.get();
        }