Skip to content

Commit

Permalink
Add nil check in ListContainerStats
Browse files Browse the repository at this point in the history
On Windows, `ds.getContainerStats` could return nil for
stopped containers.

Signed-off-by: Xinfeng Liu <XinfengLiu@icloud.com>
  • Loading branch information
xinfengliu committed Mar 8, 2024
1 parent 7b5b6d4 commit b748909
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion core/stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,9 @@ func (ds *dockerService) ListContainerStats(
return nil
}
mu.Lock()
results = append(results, stats)
if stats != nil {
results = append(results, stats)
}
mu.Unlock()
return nil
})
Expand Down

0 comments on commit b748909

Please sign in to comment.