diff --git a/BTCPayServer/Services/Labels/LabelFactory.cs b/BTCPayServer/Services/Labels/LabelFactory.cs index ff978f119..40a45102c 100644 --- a/BTCPayServer/Services/Labels/LabelFactory.cs +++ b/BTCPayServer/Services/Labels/LabelFactory.cs @@ -60,12 +60,13 @@ namespace BTCPayServer.Services.Labels TextColor = TextColor(color) }; - string PayoutLabelText(KeyValuePair> pair) + string PayoutLabelText(KeyValuePair>? pair = null) { - if (pair.Value.Count == 1) - return $"Paid a payout {(string.IsNullOrEmpty(pair.Key)? string.Empty: $"of a pull payment ({pair.Key})")}"; - else - return $"Paid {pair.Value.Count} payouts {(string.IsNullOrEmpty(pair.Key)? string.Empty: $"of a pull payment ({pair.Key})")}"; + if (pair is null) + { + return "Paid a payout"; + } + return pair.Value.Value.Count == 1 ? $"Paid a payout {(string.IsNullOrEmpty(pair.Value.Key)? string.Empty: $"of a pull payment ({pair.Value.Key})")}" : $"Paid {pair.Value.Value.Count} payouts {(string.IsNullOrEmpty(pair.Value.Key)? string.Empty: $"of a pull payment ({pair.Value.Key})")}"; } if (uncoloredLabel is ReferenceLabel refLabel) @@ -101,9 +102,13 @@ namespace BTCPayServer.Services.Labels } else if (uncoloredLabel is PayoutLabel payoutLabel) { - coloredLabel.Tooltip = payoutLabel.PullPaymentPayouts.Count > 1 - ? $"" - : PayoutLabelText(payoutLabel.PullPaymentPayouts.First()); + coloredLabel.Tooltip = payoutLabel.PullPaymentPayouts.Count switch + { + 0 => PayoutLabelText(), + 1 => PayoutLabelText(payoutLabel.PullPaymentPayouts.First()), + _ => + $"" + }; coloredLabel.Link = string.IsNullOrEmpty(payoutLabel.WalletId) ? null