tcp: fix panic on collector (#1699)

This commit is contained in:
Jan-Otto Kröpke
2024-10-17 02:29:53 +02:00
committed by GitHub
parent 92b7e445e1
commit ce2df385a6
3 changed files with 9 additions and 1 deletions

View File

@@ -44,7 +44,7 @@ func (c *Collector) Collect() (map[string]map[string]perftypes.CounterValues, er
return nil, fmt.Errorf("QueryPerformanceData: %w", err)
}
if len(perfObjects) == 0 {
if len(perfObjects) == 0 || perfObjects[0] == nil || len(perfObjects[0].Instances) == 0 {
return map[string]map[string]perftypes.CounterValues{}, nil
}