Fixed node overview crash when no cores are available

This commit is contained in:
Marcel Baumgartner 2024-04-27 21:58:20 +02:00
parent 95cfa815fb
commit eaddefdc8e

View file

@ -63,7 +63,7 @@
@if (NodeStats.ContainsKey(context!.Id) && NodeStats[context.Id] != null)
{
var cores = NodeStats[context!.Id]!.Hardware.Cores;
var percent = Math.Round(cores.Average(x => x.Usage), 2);
var percent = cores.Any() ? Math.Round(cores.Average(x => x.Usage), 2) : 0;
<ColoredBar Value="percent"/>
}