diff --git a/src/main/java/com/sparrowwallet/sparrow/control/AddAccountDialog.java b/src/main/java/com/sparrowwallet/sparrow/control/AddAccountDialog.java index 94b622eb..a7ccf229 100644 --- a/src/main/java/com/sparrowwallet/sparrow/control/AddAccountDialog.java +++ b/src/main/java/com/sparrowwallet/sparrow/control/AddAccountDialog.java @@ -14,8 +14,7 @@ import javafx.util.StringConverter; import org.controlsfx.glyphfont.Glyph; -import java.util.ArrayList; -import java.util.List; +import java.util.*; import static com.sparrowwallet.drongo.wallet.StandardAccount.*; @@ -46,12 +45,14 @@ public AddAccountDialog(Wallet wallet) { standardAccountCombo = new ComboBox<>(); standardAccountCombo.setMaxWidth(Double.MAX_VALUE); - List existingIndexes = new ArrayList<>(); + Set existingIndexes = new LinkedHashSet<>(); Wallet masterWallet = wallet.isMasterWallet() ? wallet : wallet.getMasterWallet(); existingIndexes.add(masterWallet.getAccountIndex()); for(Wallet childWallet : masterWallet.getChildWallets()) { if(!childWallet.isNested()) { existingIndexes.add(childWallet.getAccountIndex()); + Optional optStdAcc = Arrays.stream(StandardAccount.values()).filter(stdacc -> stdacc.getName().equals(childWallet.getName())).findFirst(); + optStdAcc.ifPresent(standardAccount -> existingIndexes.add(standardAccount.getAccountNumber())); } }