From f1b3f7d5dd013c574a86bd569e5da9e802ad1ea4 Mon Sep 17 00:00:00 2001 From: Craig Raw Date: Wed, 5 Jan 2022 12:41:14 +0200 Subject: [PATCH] fix regtest public server preference regression --- .../sparrow/preferences/ServerPreferencesController.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/sparrowwallet/sparrow/preferences/ServerPreferencesController.java b/src/main/java/com/sparrowwallet/sparrow/preferences/ServerPreferencesController.java index 971011e0..5679705d 100644 --- a/src/main/java/com/sparrowwallet/sparrow/preferences/ServerPreferencesController.java +++ b/src/main/java/com/sparrowwallet/sparrow/preferences/ServerPreferencesController.java @@ -359,9 +359,11 @@ public class ServerPreferencesController extends PreferencesDetailController { }); PublicElectrumServer configPublicElectrumServer = PublicElectrumServer.fromUrl(config.getPublicElectrumServer()); - if(configPublicElectrumServer == null) { + if(configPublicElectrumServer == null && PublicElectrumServer.supportedNetwork()) { List 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 { publicElectrumServer.setValue(configPublicElectrumServer); }