Ignore invalid Sones when following.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sun, 20 Nov 2011 20:32:26 +0000 (21:32 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sun, 20 Nov 2011 20:32:26 +0000 (21:32 +0100)
src/main/java/net/pterodactylus/sone/core/Core.java

index b612c74..7098299 100644 (file)
@@ -1061,6 +1061,11 @@ public class Core extends AbstractService implements IdentityListener, UpdateLis
         */
        public void followSone(Sone sone, String soneId) {
                Validation.begin().isNotNull("Sone", sone).isNotNull("Sone ID", soneId).check();
+               Sone followedSone = getSone(soneId);
+               if (followedSone == null) {
+                       logger.log(Level.INFO, String.format("Ignored Sone with invalid ID: %s", soneId));
+                       return;
+               }
                followSone(sone, getSone(soneId));
        }