summaryrefslogtreecommitdiffhomepage
path: root/app/src/main/java/com/wireguard/android
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java/com/wireguard/android')
-rw-r--r--app/src/main/java/com/wireguard/android/configStore/FileConfigStore.java4
1 files changed, 3 insertions, 1 deletions
diff --git a/app/src/main/java/com/wireguard/android/configStore/FileConfigStore.java b/app/src/main/java/com/wireguard/android/configStore/FileConfigStore.java
index 4bc7a17e..f5cd01f0 100644
--- a/app/src/main/java/com/wireguard/android/configStore/FileConfigStore.java
+++ b/app/src/main/java/com/wireguard/android/configStore/FileConfigStore.java
@@ -76,8 +76,10 @@ public final class FileConfigStore implements ConfigStore {
final File replacementFile = fileFor(replacement);
if (!replacementFile.createNewFile())
throw new IOException("Configuration for " + replacement + " already exists");
- if (!file.renameTo(replacementFile))
+ if (!file.renameTo(replacementFile)) {
+ replacementFile.delete();
throw new IOException("Cannot rename configuration file " + file.getName());
+ }
}
@Override