diff --git a/src/main/java/com/sparrowwallet/sparrow/AppServices.java b/src/main/java/com/sparrowwallet/sparrow/AppServices.java index d7c719a1..e7c7c29f 100644 --- a/src/main/java/com/sparrowwallet/sparrow/AppServices.java +++ b/src/main/java/com/sparrowwallet/sparrow/AppServices.java @@ -292,9 +292,12 @@ public class AppServices { "\n\nThis may indicate a man-in-the-middle attack!" + "\n\nDo you still want to proceed?", ButtonType.NO, ButtonType.YES); if(optButton.isPresent() && optButton.get() == ButtonType.YES) { - crtFile.delete(); - Platform.runLater(() -> restartService(connectionService)); - return; + if(crtFile.delete()) { + Platform.runLater(() -> restartService(connectionService)); + return; + } else { + AppServices.showErrorDialog("Could not delete certificate", "The certificate file at " + crtFile.getAbsolutePath() + " could not be deleted.\n\nPlease delete this file manually."); + } } } } diff --git a/src/main/java/com/sparrowwallet/sparrow/preferences/ServerPreferencesController.java b/src/main/java/com/sparrowwallet/sparrow/preferences/ServerPreferencesController.java index 5679705d..f37d10ef 100644 --- a/src/main/java/com/sparrowwallet/sparrow/preferences/ServerPreferencesController.java +++ b/src/main/java/com/sparrowwallet/sparrow/preferences/ServerPreferencesController.java @@ -587,11 +587,12 @@ public class ServerPreferencesController extends PreferencesDetailController { Optional optButton = AppServices.showErrorDialog("SSL Handshake Failed", "The certificate provided by the server at " + tlsServerException.getServer().getHost() + " appears to have changed." + "\n\nThis may indicate a man-in-the-middle attack!" + "\n\nDo you still want to proceed?", ButtonType.NO, ButtonType.YES); - if(optButton.isPresent()) { - if(optButton.get() == ButtonType.YES) { - savedCrtFile.delete(); + if(optButton.isPresent() && optButton.get() == ButtonType.YES) { + if(savedCrtFile.delete()) { Platform.runLater(this::startElectrumConnection); return; + } else { + AppServices.showErrorDialog("Could not delete certificate", "The certificate file at " + savedCrtFile.getAbsolutePath() + " could not be deleted.\n\nPlease delete this file manually."); } } }