From: David ‘Bombe’ Roden Date: Mon, 19 Sep 2011 19:19:54 +0000 (+0200) Subject: Ensure that iterating over targets never throws an exception. X-Git-Tag: 0.0.8^2~7 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=c8ce27add745df83ba513dc3fbf8908713bbc6b7;p=WoTNS.git Ensure that iterating over targets never throws an exception. --- diff --git a/src/main/java/net/pterodactylus/wotns/main/IdentityTargets.java b/src/main/java/net/pterodactylus/wotns/main/IdentityTargets.java index 0222820..54dc660 100644 --- a/src/main/java/net/pterodactylus/wotns/main/IdentityTargets.java +++ b/src/main/java/net/pterodactylus/wotns/main/IdentityTargets.java @@ -74,8 +74,10 @@ public class IdentityTargets implements Iterable> { */ @Override public Iterator> iterator() { - scanForTargets(); - return targets.entrySet().iterator(); + synchronized (targets) { + scanForTargets(); + return new HashMap(targets).entrySet().iterator(); + } } }