From: David ‘Bombe’ Roden Date: Thu, 15 Sep 2011 14:34:19 +0000 (+0200) Subject: Prevent exception if own identity does not have the correct context. X-Git-Tag: 0.0.1~16 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=8952f84e93784d14ae403f2c656f76c1366023c3;p=WoTNS.git Prevent exception if own identity does not have the correct context. 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. --- diff --git a/src/main/java/net/pterodactylus/wotns/freenet/wot/IdentityManager.java b/src/main/java/net/pterodactylus/wotns/freenet/wot/IdentityManager.java index e9107fe..eefb372 100644 --- a/src/main/java/net/pterodactylus/wotns/freenet/wot/IdentityManager.java +++ b/src/main/java/net/pterodactylus/wotns/freenet/wot/IdentityManager.java @@ -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. emptySet())); } return identities.get(); }