Make copies of lists before iterating.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 2 May 2013 19:12:16 +0000 (21:12 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 2 May 2013 19:12:16 +0000 (21:12 +0200)
src/main/java/net/pterodactylus/xdcc/ui/stdin/CommandReader.java

index 58ef4d0..2ef14d7 100644 (file)
@@ -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))) {