avoid an error labelling silent payment outputs from an open transaction tab before the wallet has fetched their transaction
What changed, and why it matters
This is a small bug-fix patch that prevents the Sparrow Wallet app from crashing with a NullPointerException when a user labels a 'silent payment' output while the wallet hasn't yet finished loading the related transaction. It adds a simple null check before using a transaction object. There is no indication this is a security vulnerability or that it can be exploited by an attacker.
No security action required. Treat as a routine stability fix. If reviewing for release notes, describe it as fixing a rare crash when labeling silent-payment outputs before the transaction is loaded.
Security signals we found
NullPointerException crash fixed
No input validation or trust-boundary changes
No cryptographic, authentication, or authorization changes
No references to CVEs, advisories, or security researchers
Evidence from the diff
In WalletForm.java, two locations dereferenced a BlockTransaction returned from a map lookup or getter without checking for null. If the transaction had not yet been fetched into the wallet’s transaction map, the code would throw a NullPointerException when processing a WalletEntryLabelsChangedEvent for silent payment outputs. The patch adds blockTransaction != null && guards before the existing label checks. This is a defensive stability fix, not a security boundary change.
Changed components
src/main/java/com/sparrowwallet/sparrow/wallet/WalletForm.javaWalletEntryLabelsChangedEvent handlerSilent payment output labelingInspect captured patch +2 / −2
### src/main/java/com/sparrowwallet/sparrow/wallet/WalletForm.java
@@ -725,7 +725,7 @@ public void walletLabelsChanged(WalletEntryLabelsChangedEvent event) {
if(entry instanceof NodeEntry nodeEntry) {
for(BlockTransactionHashIndex receivedRef : nodeEntry.getNode().getTransactionOutputs()) {
BlockTransaction blockTransaction = event.getWallet().getTransactions().get(receivedRef.getHash());
- if(blockTransaction.getLabel() == null || blockTransaction.getLabel().isEmpty()) {
+ if(blockTransaction != null && (blockTransaction.getLabel() == null || blockTransaction.getLabel().isEmpty())) {
blockTransaction.setLabel(entry.getLabel());
labelChangedEntries.put(new TransactionEntry(event.getWallet(), blockTransaction, Collections.emptyMap(), Collections.emptyMap()), entry);
}
@@ -734,7 +734,7 @@ public void walletLabelsChanged(WalletEntryLabelsChangedEvent event) {
if(entry instanceof HashIndexEntry hashIndexEntry) {
BlockTransaction blockTransaction = hashIndexEntry.getBlockTransaction();
//Avoid recursive changes from hashIndexEntries
- if((blockTransaction.getLabel() == null || blockTransaction.getLabel().isEmpty()) && event.getSource(entry) == null) {
+ if(blockTransaction != null && (blockTransaction.getLabel() == null || blockTransaction.getLabel().isEmpty()) && event.getSource(entry) == null) {
blockTransaction.setLabel(entry.getLabel());
labelChangedEntries.put(new TransactionEntry(event.getWallet(), blockTransaction, Collections.emptyMap(), Collections.emptyMap()), entry);
}Why this scored 17/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.