Skip to content

Commit

Permalink
fix npe accessing funding address entry from api
Browse files Browse the repository at this point in the history
  • Loading branch information
woodser committed Dec 27, 2024
1 parent cccd9cf commit fc1388d
Showing 1 changed file with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,15 +124,17 @@ protected void run() {
offer.getOfferPayload().setReserveTxKeyImages(reservedKeyImages);

// reset offer funding address entry if unused
List<MoneroOutputWallet> inputs = model.getXmrWalletService().getOutputs(reservedKeyImages);
boolean usesFundingEntry = false;
for (MoneroOutputWallet input : inputs) {
if (input.getAccountIndex() == 0 && input.getSubaddressIndex() == fundingEntry.getSubaddressIndex()) {
usesFundingEntry = true;
break;
if (fundingEntry != null) {
List<MoneroOutputWallet> inputs = model.getXmrWalletService().getOutputs(reservedKeyImages);
boolean usesFundingEntry = false;
for (MoneroOutputWallet input : inputs) {
if (input.getAccountIndex() == 0 && input.getSubaddressIndex() == fundingEntry.getSubaddressIndex()) {
usesFundingEntry = true;
break;
}
}
if (!usesFundingEntry) model.getXmrWalletService().swapAddressEntryToAvailable(offer.getId(), XmrAddressEntry.Context.OFFER_FUNDING);
}
if (!usesFundingEntry) model.getXmrWalletService().swapAddressEntryToAvailable(offer.getId(), XmrAddressEntry.Context.OFFER_FUNDING);
}
complete();
} catch (Throwable t) {
Expand Down

0 comments on commit fc1388d

Please sign in to comment.