fix npe accessing funding address entry from api
Some checks failed
Codacy Coverage Reporter / Publish coverage (push) Has been cancelled
CodeQL / Analyze (push) Has been cancelled
CI / build (macos-13) (push) Has been cancelled
CI / build (ubuntu-22.04) (push) Has been cancelled
CI / build (windows-latest) (push) Has been cancelled

This commit is contained in:
woodser 2024-12-27 11:57:47 -05:00
parent cccd9cf094
commit fc1388d2f4

View file

@ -124,15 +124,17 @@ public class MakerReserveOfferFunds extends Task<PlaceOfferModel> {
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) {