POS: Fix exception when asking for data with a top up item (#5816)

Fixes #5811.
This commit is contained in:
d11n 2024-03-11 11:05:44 +01:00 committed by GitHub
parent 15ce148b99
commit dcc6f17c9c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -292,13 +292,13 @@ namespace BTCPayServer.Plugins.PointOfSale.Controllers
} }
var amtField = form.GetFieldByFullName($"{FormDataService.InvoiceParameterPrefix}amount"); var amtField = form.GetFieldByFullName($"{FormDataService.InvoiceParameterPrefix}amount");
if (amtField is null && price.HasValue) if (amtField is null)
{ {
form.Fields.Add(new Field form.Fields.Add(new Field
{ {
Name = $"{FormDataService.InvoiceParameterPrefix}amount", Name = $"{FormDataService.InvoiceParameterPrefix}amount",
Type = "hidden", Type = "hidden",
Value = price.ToString(), Value = price?.ToString(),
Constant = true Constant = true
}); });
} }