ProgressTask.GetPercentage() returns 100 when max value is 0 (#1694)

This commit is contained in:
Frank Ray
2024-11-22 11:44:00 +00:00
committed by GitHub
parent be45494d6e
commit 4515d89705
2 changed files with 30 additions and 0 deletions

View File

@ -224,6 +224,11 @@ public sealed class ProgressTask : IProgress<double>
private double GetPercentage()
{
if (MaxValue == 0)
{
return 100;
}
var percentage = (Value / MaxValue) * 100;
percentage = Math.Min(100, Math.Max(0, percentage));
return percentage;