From ce7a48c4eda76cad0be79a58a31bff08b99a14d3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Thu, 30 Apr 2015 06:39:17 +0200 Subject: [PATCH] Synchronize all access on packs --- src/main/java/net/pterodactylus/xdcc/data/Bot.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/pterodactylus/xdcc/data/Bot.java b/src/main/java/net/pterodactylus/xdcc/data/Bot.java index 3ca34f3..0f09671 100644 --- a/src/main/java/net/pterodactylus/xdcc/data/Bot.java +++ b/src/main/java/net/pterodactylus/xdcc/data/Bot.java @@ -82,7 +82,9 @@ public class Bot implements Iterable { * @return The packs this bot carries */ public Collection packs() { - return packs.values(); + synchronized (packs) { + return packs.values(); + } } // @@ -128,7 +130,7 @@ public class Bot implements Iterable { @Override public Iterator iterator() { - return packs.values().iterator(); + return packs().iterator(); } // -- 2.7.4