Treat invalid own identity as no own identity.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 16 Sep 2011 15:44:54 +0000 (17:44 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 16 Sep 2011 15:44:54 +0000 (17:44 +0200)
src/main/java/net/pterodactylus/wotns/main/Resolver.java

index 0150f45..0d94ce2 100644 (file)
@@ -87,7 +87,9 @@ public class Resolver {
                }
                @SuppressWarnings("hiding")
                final OwnIdentity ownIdentity;
-               if (this.ownIdentityId == null) {
+               if ((this.ownIdentityId != null) && (identityManager.getOwnIdentity(this.ownIdentityId) != null)) {
+                       ownIdentity = identityManager.getOwnIdentity(this.ownIdentityId);
+               } else if (this.ownIdentityId == null) {
                        Set<OwnIdentity> ownIdentities = identityManager.getAllOwnIdentities();
                        if (!ownIdentities.isEmpty()) {
                                ownIdentity = ownIdentities.iterator().next();
@@ -95,7 +97,7 @@ public class Resolver {
                                ownIdentity = null;
                        }
                } else {
-                       ownIdentity = identityManager.getOwnIdentity(ownIdentityId);
+                       ownIdentity = null;
                }
                if (ownIdentity == null) {
                        return null;