Crowdfund: Fix null pointer exception for topup type (missing price) (#5068)

Items with type topup have a price = null and hence not even the property set (ignored in JSON). This needs to be handled in the temlate, otherwise this exception occurs:

```
An unhandled exception was thrown by the application.
System.InvalidOperationException: Nullable object must have a value.
   at AspNetCoreGeneratedDocument.Views_Shared_Crowdfund_Public_ContributeForm.<>c__DisplayClass24_0.<<ExecuteAsync>b__0>d.MoveNext()
```
This commit is contained in:
d11n
2023-06-13 13:46:27 +02:00
committed by GitHub
parent 6d0f9120b8
commit a84ffd8c7e

View File

@@ -1,4 +1,3 @@
@using BTCPayServer.Models.AppViewModels
@using BTCPayServer.Plugins.PointOfSale.Models
@model BTCPayServer.Plugins.Crowdfund.Models.ContributeToCrowdfund
@@ -28,7 +27,7 @@
@(string.IsNullOrEmpty(item.Title) ? item.Id : item.Title)
</label>
<span class="text-muted">
@if (item.Price.Value > 0)
@if (item.Price is > 0)
{
<span>@item.Price.Value</span>
<span>@vm.TargetCurrency</span>