diff --git a/app/src/main/java/info/nightscout/androidaps/queue/CommandQueue.java b/app/src/main/java/info/nightscout/androidaps/queue/CommandQueue.java index 2ef2d5198a..69979508fe 100644 --- a/app/src/main/java/info/nightscout/androidaps/queue/CommandQueue.java +++ b/app/src/main/java/info/nightscout/androidaps/queue/CommandQueue.java @@ -96,7 +96,7 @@ public class CommandQueue { } private synchronized void removeAll(Command.CommandType type) { - for (int i = 0; i < queue.size(); i++) { + for (int i = queue.size() - 1; i >= 0; i--) { if (queue.get(i).commandType == type) { queue.remove(i); }