From eb676b3dc1fe6f14cdd845c16ef1bf8fa2d1d725 Mon Sep 17 00:00:00 2001 From: Sander van Grieken Date: Mon, 23 Oct 2023 15:30:56 +0200 Subject: [PATCH] qml: don't show error when textfield is empty, don't log error when optional propert is undefined --- .../gui/qml/components/wizard/WCHaveMasterKey.qml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/electrum/gui/qml/components/wizard/WCHaveMasterKey.qml b/electrum/gui/qml/components/wizard/WCHaveMasterKey.qml index cea7bfb46..5882102ac 100644 --- a/electrum/gui/qml/components/wizard/WCHaveMasterKey.qml +++ b/electrum/gui/qml/components/wizard/WCHaveMasterKey.qml @@ -15,7 +15,7 @@ WizardComponent { property int cosigner: 0 property int participants: 0 - property string multisigMasterPubkey: wizard_data['multisig_master_pubkey'] + property string multisigMasterPubkey function apply() { applyMasterKey(masterkey_ta.text) @@ -35,6 +35,11 @@ WizardComponent { validationtext.text = '' key = key.trim() + if (!key) { + validationtext.text = '' + return false + } + if (!bitcoin.verifyMasterKey(key, wizard_data['wallet_type'])) { validationtext.text = qsTr('Error: invalid master key') return false @@ -179,7 +184,9 @@ WizardComponent { Bitcoin { id: bitcoin - onValidationMessageChanged: validationtext.text = validationMessage + onValidationMessageChanged: { + validationtext.text = validationMessage + } } Component.onCompleted: { @@ -187,6 +194,10 @@ WizardComponent { if ('multisig_current_cosigner' in wizard_data) cosigner = wizard_data['multisig_current_cosigner'] participants = wizard_data['multisig_participants'] + + if ('multisig_master_pubkey' in wizard_data) { + multisigMasterPubkey = wizard_data['multisig_master_pubkey'] + } } Qt.callLater(masterkey_ta.forceActiveFocus) }