From b0dc5c6f6d32319d8035e15490a899aed14199d2 Mon Sep 17 00:00:00 2001 From: orogvany Date: Fri, 25 May 2018 08:06:23 -0700 Subject: [PATCH] GUI: check if wallet unlocked before updating send Avoid logspam with attempting to read from wallet for rending address book. fixes #907 --- .../java/org/semux/gui/panel/SendPanel.java | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/main/java/org/semux/gui/panel/SendPanel.java b/src/main/java/org/semux/gui/panel/SendPanel.java index 903f480f1..efa8f8966 100644 --- a/src/main/java/org/semux/gui/panel/SendPanel.java +++ b/src/main/java/org/semux/gui/panel/SendPanel.java @@ -336,17 +336,18 @@ protected void refresh() { } } - // add aliases to list of accounts - for (Map.Entry address : kernel.getWallet().getAddressAliases().entrySet()) { - // only add aliases not in wallet - if (kernel.getWallet().getAccount(address.getKey().getData()) == null) { - accountItems.add(new AccountItem(address.getValue(), address.getKey().getData())); + // 'to' contains all current accounts and address book, only update if user + // isn't interacting with it, and wallet is unlocked + if (!selectTo.isPopupVisible() && kernel.getWallet().isUnlocked()) { + + // add aliases to list of accounts + for (Map.Entry address : kernel.getWallet().getAddressAliases().entrySet()) { + // only add aliases not in wallet + if (kernel.getWallet().getAccount(address.getKey().getData()) == null) { + accountItems.add(new AccountItem(address.getValue(), address.getKey().getData())); + } } - } - // 'to' contains all current accounts and address book, only update if user - // isn't interacting with it - if (!selectTo.isPopupVisible()) { Object toSelected = selectTo.getSelectedItem(); selectTo.removeAllItems();