mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-12-23 20:36:44 +00:00
fix export of sparrow wallet from settings screen
This commit is contained in:
parent
f65fec66bb
commit
771bd1545c
1 changed files with 11 additions and 2 deletions
|
@ -316,8 +316,17 @@ public class SettingsController extends WalletFormController implements Initiali
|
|||
}
|
||||
|
||||
public void exportWallet(ActionEvent event) {
|
||||
WalletExportDialog dlg = new WalletExportDialog(walletForm.getWallet());
|
||||
dlg.showAndWait();
|
||||
if(walletForm.getWalletFile() == null) {
|
||||
throw new IllegalStateException("Cannot export unsaved wallet");
|
||||
}
|
||||
|
||||
Optional<Wallet> optWallet = AppServices.get().getOpenWallets().entrySet().stream().filter(entry -> walletForm.getWalletFile().equals(entry.getValue().getWalletFile())).map(Map.Entry::getKey).findFirst();
|
||||
if(optWallet.isPresent()) {
|
||||
WalletExportDialog dlg = new WalletExportDialog(optWallet.get());
|
||||
dlg.showAndWait();
|
||||
} else {
|
||||
AppServices.showErrorDialog("Cannot export wallet", "Wallet cannot be exported, please save it first.");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue