Prechádzať zdrojové kódy

Fixed node overview crash when no cores are available

Marcel Baumgartner 1 rok pred
rodič
commit
eaddefdc8e

+ 1 - 1
Moonlight/Features/Servers/UI/Views/Admin/Nodes/Index.razor

@@ -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"/>
                     }