From 173078dd8d6087a766805c6861a5ca989068f02f Mon Sep 17 00:00:00 2001 From: Craig Raw Date: Wed, 17 Feb 2021 11:10:08 +0200 Subject: [PATCH] followup to script type descriptions --- .../sparrowwallet/sparrow/wallet/SettingsController.java | 9 ++++++--- src/main/resources/com/sparrowwallet/sparrow/app.fxml | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/sparrowwallet/sparrow/wallet/SettingsController.java b/src/main/java/com/sparrowwallet/sparrow/wallet/SettingsController.java index 71e8fd68..d0220be9 100644 --- a/src/main/java/com/sparrowwallet/sparrow/wallet/SettingsController.java +++ b/src/main/java/com/sparrowwallet/sparrow/wallet/SettingsController.java @@ -109,12 +109,12 @@ public class SettingsController extends WalletFormController implements Initiali scriptType.setConverter(new StringConverter<>() { @Override public String toString(ScriptType scriptType) { - return scriptType.getDescription(); + return scriptType == null ? "" : scriptType.getDescription(); } @Override public ScriptType fromString(String string) { - return ScriptType.fromDescriptor(string); + return Arrays.stream(ScriptType.values()).filter(type -> type.getDescription().equals(string)).findFirst().orElse(null); } }); @@ -330,7 +330,10 @@ public class SettingsController extends WalletFormController implements Initiali wallet.setDefaultPolicy(Policy.getPolicy(wallet.getPolicyType(), wallet.getScriptType(), wallet.getKeystores(), (int)multisigControl.getLowValue())); } - descriptor.setWallet(wallet); + if(ScriptType.getAddressableScriptTypes(wallet.getPolicyType()).contains(wallet.getScriptType())) { + descriptor.setWallet(wallet); + } + revert.setDisable(false); apply.setDisable(!wallet.isValid()); } diff --git a/src/main/resources/com/sparrowwallet/sparrow/app.fxml b/src/main/resources/com/sparrowwallet/sparrow/app.fxml index 6d211e83..7e1b8a5d 100644 --- a/src/main/resources/com/sparrowwallet/sparrow/app.fxml +++ b/src/main/resources/com/sparrowwallet/sparrow/app.fxml @@ -9,7 +9,7 @@ - +