Do not crash UI and background services after switching to BItcoin Only when you have altcoin payments

This commit is contained in:
Kukks
2020-08-09 14:43:13 +02:00
parent a80146e894
commit 26aac6c45d
18 changed files with 79 additions and 35 deletions

View File

@@ -104,10 +104,16 @@ namespace BTCPayServer.PaymentRequest
Currency = entity.ProductInformation.Currency,
ExpiryDate = entity.ExpirationTime.DateTime,
Status = entity.GetInvoiceState().ToString(),
Payments = entity.GetPayments().Select(paymentEntity =>
Payments = entity
.GetPayments()
.Select(paymentEntity =>
{
var paymentData = paymentEntity.GetCryptoPaymentData();
var paymentMethodId = paymentEntity.GetPaymentMethodId();
if (paymentData is null || paymentMethodId is null)
{
return null;
}
string txId = paymentData.GetPaymentId();
string link = GetTransactionLink(paymentMethodId, txId);
@@ -118,7 +124,9 @@ namespace BTCPayServer.PaymentRequest
Link = link,
Id = txId
};
}).ToList()
})
.Where(payment => payment != null)
.ToList()
}).ToList()
};
}