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

Fix: Removing futures by index

parent 2fd3cd82
...@@ -307,11 +307,8 @@ public class PushDialog extends Dialog { ...@@ -307,11 +307,8 @@ public class PushDialog extends Dialog {
for (int i = futures.size() - 1; i >= 0; i--) { for (int i = futures.size() - 1; i >= 0; i--) {
Future<?> future = futures.get(i); Future<?> future = futures.get(i);
if (future == null) { if (future == null || future.isDone() || future.isCancelled()) {
continue; futures.remove(i);
}
if (future.isDone() || future.isCancelled()) {
futures.remove(future);
} else { } else {
future.cancel(true); future.cancel(true);
} }
...@@ -526,11 +523,8 @@ public class PushDialog extends Dialog { ...@@ -526,11 +523,8 @@ public class PushDialog extends Dialog {
do { do {
for (int i = futures.size() - 1; i >= 0; i--) { for (int i = futures.size() - 1; i >= 0; i--) {
Future<?> future = futures.get(i); Future<?> future = futures.get(i);
if (future == null) { if (future == null || future.isDone()) {
continue; futures.remove(i);
}
if (future.isDone()) {
futures.remove(future);
} }
} }
......
Supports Markdown
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