Browse Source

fix regtest public server preference regression

terminal
Craig Raw 3 years ago
parent
commit
f1b3f7d5dd
  1. 6
      src/main/java/com/sparrowwallet/sparrow/preferences/ServerPreferencesController.java

6
src/main/java/com/sparrowwallet/sparrow/preferences/ServerPreferencesController.java

@ -359,9 +359,11 @@ public class ServerPreferencesController extends PreferencesDetailController {
}); });
PublicElectrumServer configPublicElectrumServer = PublicElectrumServer.fromUrl(config.getPublicElectrumServer()); PublicElectrumServer configPublicElectrumServer = PublicElectrumServer.fromUrl(config.getPublicElectrumServer());
if(configPublicElectrumServer == null) { if(configPublicElectrumServer == null && PublicElectrumServer.supportedNetwork()) {
List<PublicElectrumServer> servers = PublicElectrumServer.getServers(); List<PublicElectrumServer> servers = PublicElectrumServer.getServers();
publicElectrumServer.setValue(servers.get(new Random().nextInt(servers.size()))); if(!servers.isEmpty()) {
publicElectrumServer.setValue(servers.get(new Random().nextInt(servers.size())));
}
} else { } else {
publicElectrumServer.setValue(configPublicElectrumServer); publicElectrumServer.setValue(configPublicElectrumServer);
} }

Loading…
Cancel
Save