Skip to content

Commit

Permalink
Always check if a valid BSQ block explorer is set
Browse files Browse the repository at this point in the history
  • Loading branch information
wiz committed Dec 18, 2019
1 parent e41df65 commit 8b23cac
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions core/src/main/java/bisq/core/user/Preferences.java
Original file line number Diff line number Diff line change
Expand Up @@ -233,10 +233,6 @@ public void readPersisted() {
throw new RuntimeException("BaseCurrencyNetwork not defined. BaseCurrencyNetwork=" + baseCurrencyNetwork);
}

// if no preference is set, randomly select a BSQ block explorer for the user
ArrayList<BlockChainExplorer> bsqExplorers = getBsqBlockChainExplorers();
setBsqBlockChainExplorer(bsqExplorers.get((new Random()).nextInt(bsqExplorers.size())));

prefPayload.setDirectoryChooserPath(Utilities.getSystemHomeDirectory());

prefPayload.setOfferBookChartScreenCurrencyCode(preferredTradeCurrency.getCode());
Expand All @@ -256,6 +252,12 @@ public void readPersisted() {
useStandbyModeProperty.set(prefPayload.isUseStandbyMode());
cssThemeProperty.set(prefPayload.getCssTheme());

// if no valid block explorer is set, randomly select a valid BSQ block explorer
ArrayList<BlockChainExplorer> bsqExplorers = getBsqBlockChainExplorers();
BlockChainExplorer bsqExplorer = getBsqBlockChainExplorer();
if (bsqExplorer == null || bsqExplorers.contains(bsqExplorer) == false)
setBsqBlockChainExplorer(bsqExplorers.get((new Random()).nextInt(bsqExplorers.size())));

tradeCurrenciesAsObservable.addAll(prefPayload.getFiatCurrencies());
tradeCurrenciesAsObservable.addAll(prefPayload.getCryptoCurrencies());
dontShowAgainMapAsObservable.putAll(getDontShowAgainMap());
Expand Down

0 comments on commit 8b23cac

Please sign in to comment.