summaryrefslogtreecommitdiffhomepage
path: root/app/src/main/java/com/wireguard/android/model/TunnelManager.java
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java/com/wireguard/android/model/TunnelManager.java')
-rw-r--r--app/src/main/java/com/wireguard/android/model/TunnelManager.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/src/main/java/com/wireguard/android/model/TunnelManager.java b/app/src/main/java/com/wireguard/android/model/TunnelManager.java
index 5122f9bf..b6f6819d 100644
--- a/app/src/main/java/com/wireguard/android/model/TunnelManager.java
+++ b/app/src/main/java/com/wireguard/android/model/TunnelManager.java
@@ -70,7 +70,11 @@ public final class TunnelManager {
Log.v(TAG, "Requested delete tunnel " + tunnel.getName() + " state=" + tunnel.getState());
return backend.setState(tunnel, State.DOWN)
.thenCompose(x -> configStore.delete(tunnel.getName()))
- .thenAccept(x -> tunnels.remove(tunnel.getName()));
+ .thenAccept(x -> {
+ tunnels.remove(tunnel.getName());
+ if (tunnel.getName().equals(preferences.getString(KEY_PRIMARY_TUNNEL, null)))
+ preferences.edit().remove(KEY_PRIMARY_TUNNEL).apply();
+ });
}
public TunnelCollection getTunnels() {