From: David ‘Bombe’ Roden Date: Sun, 20 Nov 2011 20:54:54 +0000 (+0100) Subject: Ignore Sones with invalid IDs. X-Git-Tag: 0.7.4^2~5 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=5bc04b55aa0bd5f9f9a3d01b8989b73fa8fa1f85;p=Sone.git Ignore Sones with invalid IDs. --- diff --git a/src/main/java/net/pterodactylus/sone/core/Core.java b/src/main/java/net/pterodactylus/sone/core/Core.java index 8c2dabb..81c5185 100644 --- a/src/main/java/net/pterodactylus/sone/core/Core.java +++ b/src/main/java/net/pterodactylus/sone/core/Core.java @@ -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; }