guard a short server.version response in the desktop and terminal connection tests
What changed, and why it matters
This commit fixes a minor crash bug in Sparrow Wallet's connection-test screens. Previously, if a Bitcoin Electrum server answered the version request with an unusually short response, the wallet would try to read list items that didn't exist and throw an IndexOutOfBoundsException. The patch now checks that the list has at least one element before using it and only appends the protocol version if a second element exists. It is a UI-only hardening change, not a cryptographic or funds-theft issue.
Treat as a low-priority robustness fix. No immediate user action required; updating to a release containing this commit removes a minor UI crash when testing connections to non-standard Electrum servers.
Security signals we found
Input validation hardening for external server response
IndexOutOfBoundsException prevented in UI feedback path
No cryptographic, authentication, or transaction logic touched
Evidence from the diff
ServerSettingsController.showConnectionSuccess() and ServerTestDialog.showConnectionSuccess() both assumed the server.version response List
Changed components
Desktop settings connection test UI (ServerSettingsController.java)Terminal settings connection test UI (ServerTestDialog.java)Inspect captured patch +4 / −4
### src/main/java/com/sparrowwallet/sparrow/settings/ServerSettingsController.java
@@ -660,8 +660,8 @@ private void setFieldsEditable(boolean editable) {
private void showConnectionSuccess(List<String> serverVersion, String serverBanner) {
testConnection.setGraphic(getGlyph(FontAwesome5.Glyph.CHECK_CIRCLE, "success"));
- if(serverVersion != null) {
- testResults.setText("Connected to " + serverVersion.get(0) + " on protocol version " + serverVersion.get(1));
+ if(serverVersion != null && !serverVersion.isEmpty()) {
+ testResults.setText("Connected to " + serverVersion.getFirst() + (serverVersion.size() > 1 ? " on protocol version " + serverVersion.get(1) : ""));
ServerCapability serverCapability = ElectrumServer.getServerCapability(serverVersion);
if(serverCapability.supportsBatching()) {
testResults.setText(testResults.getText() + "\nBatched RPC enabled.");
### src/main/java/com/sparrowwallet/sparrow/terminal/settings/ServerTestDialog.java
@@ -168,8 +168,8 @@ private void appendText(String text) {
private void showConnectionSuccess(List<String> serverVersion, String serverBanner) {
testStatus.setText("Success");
- if(serverVersion != null) {
- testResults.setText("Connected to " + serverVersion.get(0) + " on protocol version " + serverVersion.get(1));
+ if(serverVersion != null && !serverVersion.isEmpty()) {
+ testResults.setText("Connected to " + serverVersion.getFirst() + (serverVersion.size() > 1 ? " on protocol version " + serverVersion.get(1) : ""));
ServerCapability serverCapability = ElectrumServer.getServerCapability(serverVersion);
if(serverCapability.supportsBatching()) {
testResults.setText(testResults.getText() + "\nBatched RPC enabled.");Why this scored 18/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.