From a84ffd8c7eb81d3d89b3d97dacb2196af1dac1ff Mon Sep 17 00:00:00 2001 From: d11n Date: Tue, 13 Jun 2023 13:46:27 +0200 Subject: [PATCH] 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.<b__0>d.MoveNext() ``` --- .../Views/Shared/Crowdfund/Public/ContributeForm.cshtml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/BTCPayServer/Views/Shared/Crowdfund/Public/ContributeForm.cshtml b/BTCPayServer/Views/Shared/Crowdfund/Public/ContributeForm.cshtml index 76f224a67..0acbb93f5 100644 --- a/BTCPayServer/Views/Shared/Crowdfund/Public/ContributeForm.cshtml +++ b/BTCPayServer/Views/Shared/Crowdfund/Public/ContributeForm.cshtml @@ -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) - @if (item.Price.Value > 0) + @if (item.Price is > 0) { @item.Price.Value @vm.TargetCurrency