summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--ui/src/main/java/com/wireguard/android/fragment/TunnelListFragment.kt6
1 files changed, 2 insertions, 4 deletions
diff --git a/ui/src/main/java/com/wireguard/android/fragment/TunnelListFragment.kt b/ui/src/main/java/com/wireguard/android/fragment/TunnelListFragment.kt
index cb3636fe..ff7b8bce 100644
--- a/ui/src/main/java/com/wireguard/android/fragment/TunnelListFragment.kt
+++ b/ui/src/main/java/com/wireguard/android/fragment/TunnelListFragment.kt
@@ -316,10 +316,8 @@ class TunnelListFragment : BaseFragment() {
Application.getTunnelManager().tunnels.thenAccept { tunnels ->
val tunnelsToDelete = ArrayList<ObservableTunnel>()
for (position in copyCheckedItems) tunnelsToDelete.add(tunnels[position])
- val futures = tunnelsToDelete
- .map { obj -> obj.delete() }
- .toTypedArray()
- CompletableFuture.allOf(*futures as Array<out CompletableFuture<*>>)
+ val futures = tunnelsToDelete.map { it.delete().toCompletableFuture() }.toTypedArray()
+ CompletableFuture.allOf(*futures)
.thenApply { futures.size }
.whenComplete(this@TunnelListFragment::onTunnelDeletionFinished)
}