From 47f7b8870c8a493e624ca568d8b1a8e70ffcfc7a Mon Sep 17 00:00:00 2001 From: Craig Raw Date: Mon, 21 Nov 2022 08:51:09 +0200 Subject: [PATCH] fix cancel of create wallet in terminal --- .../sparrow/terminal/MasterActionListBox.java | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/sparrowwallet/sparrow/terminal/MasterActionListBox.java b/src/main/java/com/sparrowwallet/sparrow/terminal/MasterActionListBox.java index a442971b..95adbd12 100644 --- a/src/main/java/com/sparrowwallet/sparrow/terminal/MasterActionListBox.java +++ b/src/main/java/com/sparrowwallet/sparrow/terminal/MasterActionListBox.java @@ -147,17 +147,19 @@ public class MasterActionListBox extends ActionListBox { newWalletNameBuilder.setValidator(content -> content.isEmpty() ? "Please enter a name" : (Storage.walletExists(content) ? "Wallet already exists" : null)); String walletName = newWalletNameBuilder.build().showDialog(SparrowTerminal.get().getGui()); - ActionListDialogBuilder newBuilder = new ActionListDialogBuilder(); - newBuilder.setTitle("Create Wallet"); - newBuilder.setDescription("Choose the type of wallet"); - newBuilder.addAction("Software (BIP39)", () -> { - Bip39Dialog bip39Dialog = new Bip39Dialog(walletName); - bip39Dialog.showDialog(SparrowTerminal.get().getGui()); - }); - newBuilder.addAction("Watch Only", () -> { - WatchOnlyDialog watchOnlyDialog = new WatchOnlyDialog(walletName); - watchOnlyDialog.showDialog(SparrowTerminal.get().getGui()); - }); - newBuilder.build().showDialog(SparrowTerminal.get().getGui()); + if(walletName != null) { + ActionListDialogBuilder newBuilder = new ActionListDialogBuilder(); + newBuilder.setTitle("Create Wallet"); + newBuilder.setDescription("Choose the type of wallet"); + newBuilder.addAction("Software (BIP39)", () -> { + Bip39Dialog bip39Dialog = new Bip39Dialog(walletName); + bip39Dialog.showDialog(SparrowTerminal.get().getGui()); + }); + newBuilder.addAction("Watch Only", () -> { + WatchOnlyDialog watchOnlyDialog = new WatchOnlyDialog(walletName); + watchOnlyDialog.showDialog(SparrowTerminal.get().getGui()); + }); + newBuilder.build().showDialog(SparrowTerminal.get().getGui()); + } } }