Commit 18d749b2 authored by Matija Obreza's avatar Matija Obreza

Fix: Removing futures by index

parent 2fd3cd82
......@@ -307,11 +307,8 @@ public class PushDialog extends Dialog {
for (int i = futures.size() - 1; i >= 0; i--) {
Future<?> future = futures.get(i);
if (future == null) {
continue;
}
if (future.isDone() || future.isCancelled()) {
futures.remove(future);
if (future == null || future.isDone() || future.isCancelled()) {
futures.remove(i);
} else {
future.cancel(true);
}
......@@ -526,11 +523,8 @@ public class PushDialog extends Dialog {
do {
for (int i = futures.size() - 1; i >= 0; i--) {
Future<?> future = futures.get(i);
if (future == null) {
continue;
}
if (future.isDone()) {
futures.remove(future);
if (future == null || future.isDone()) {
futures.remove(i);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment