diff --git a/WELA.ps1 b/WELA.ps1 index 52ffa52e..e6e7d3b5 100644 --- a/WELA.ps1 +++ b/WELA.ps1 @@ -72,7 +72,8 @@ function CalculateUsableRate { $totalCounts | ForEach-Object { $level = $_.Level $total = $_.Count - $usableCount = ($counts | Where-Object Level -eq $level | Select-Object -ExpandProperty Count -First 1) -or 0 + $usableCount = ($counts | Where-Object Level -eq $level | Select-Object -ExpandProperty Count -First 1) + if ($null -eq $usableCount) { $usableCount = 0 } $percentage = if ($total -ne 0) { "{0:N2}" -f ($usableCount / $total * 100) } else { "0.00" } $result += [PSCustomObject]@{ Level = $level