fix npe with xmrNodes with onion address

This commit is contained in:
woodser 2025-03-07 07:12:02 -05:00 committed by GitHub
parent 68f7067125
commit c9350e123e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -112,8 +112,7 @@ public class XmrLocalNode {
// determine if local node is configured
boolean hasConfiguredLocalNode = false;
for (XmrNode node : xmrNodes.selectPreferredNodes(new XmrNodesSetupPreferences(preferences))) {
String prefix = node.getAddress().startsWith("http") ? "" : "http://";
if (equalsUri(prefix + node.getAddress() + ":" + node.getPort())) {
if (node.getAddress() != null && equalsUri("http://" + node.getAddress() + ":" + node.getPort())) {
hasConfiguredLocalNode = true;
break;
}
@ -139,7 +138,11 @@ public class XmrLocalNode {
}
public boolean equalsUri(String uri) {
return HavenoUtils.isLocalHost(uri) && MoneroUtils.parseUri(uri).getPort() == HavenoUtils.getDefaultMoneroPort();
try {
return HavenoUtils.isLocalHost(uri) && MoneroUtils.parseUri(uri).getPort() == HavenoUtils.getDefaultMoneroPort();
} catch (Exception e) {
return false;
}
}
/**