From: David ‘Bombe’ Roden Date: Thu, 2 May 2013 19:12:16 +0000 (+0200) Subject: Make copies of lists before iterating. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=d3a8f3edb125265c6feb8b0ccfaa035497c07f15;p=xudocci.git Make copies of lists before iterating. --- diff --git a/src/main/java/net/pterodactylus/xdcc/ui/stdin/CommandReader.java b/src/main/java/net/pterodactylus/xdcc/ui/stdin/CommandReader.java index 58ef4d0..2ef14d7 100644 --- a/src/main/java/net/pterodactylus/xdcc/ui/stdin/CommandReader.java +++ b/src/main/java/net/pterodactylus/xdcc/ui/stdin/CommandReader.java @@ -94,8 +94,8 @@ public class CommandReader extends AbstractExecutionThreadService { String[] words = line.split(" +"); if (words[0].equalsIgnoreCase("search")) { lastResult.clear(); - for (Bot bot : core.bots()) { - for (Pack pack : bot) { + for (Bot bot : Lists.newArrayList(core.bots())) { + for (Pack pack : Lists.newArrayList(bot)) { boolean found = true; for (int wordIndex = 1; wordIndex < words.length; ++wordIndex) { if (words[wordIndex].startsWith("-") && pack.name().toLowerCase().contains(words[wordIndex].toLowerCase().substring(1))) {