From 8952f84e93784d14ae403f2c656f76c1366023c3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Thu, 15 Sep 2011 16:34:19 +0200 Subject: [PATCH] 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. --- src/main/java/net/pterodactylus/wotns/freenet/wot/IdentityManager.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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(); } -- 2.7.4