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

index 8c2dabb..81c5185 100644 (file)
@@ -2414,8 +2414,13 @@ public class Core extends AbstractService implements IdentityListener, UpdateLis
                                break;
                        }
                        long time = configuration.getLongValue("SoneFollowingTimes/" + soneCounter + "/Time").getValue(Long.MAX_VALUE);
-                       synchronized (soneFollowingTimes) {
-                               soneFollowingTimes.put(getSone(soneId), time);
+                       Sone followedSone = getSone(soneId);
+                       if (followedSone == null) {
+                               logger.log(Level.WARNING, String.format("Ignoring Sone with invalid ID: %s", soneId));
+                       } else {
+                               synchronized (soneFollowingTimes) {
+                                       soneFollowingTimes.put(getSone(soneId), time);
+                               }
                        }
                        ++soneCounter;
                }