Merge pull request #1503 from jotomo/cmd-queue-remove-all

[For review] Queue: correct removal of queued command by type.
This commit is contained in:
Milos Kozak 2018-10-12 17:08:14 +02:00 committed by GitHub
commit 4d5ee23245
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -96,7 +96,7 @@ public class CommandQueue {
} }
private synchronized void removeAll(Command.CommandType type) { 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) { if (queue.get(i).commandType == type) {
queue.remove(i); queue.remove(i);
} }