Skip to content
This repository was archived by the owner on Feb 8, 2021. It is now read-only.

Commit aec1c27

Browse files
committed
XPod.Stats: don't call goroutine if p.sandbox is nil
Signed-off-by: Hui Zhu <teawater@hyper.sh>
1 parent 3b8e87f commit aec1c27

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

daemon/pod/pod.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -299,10 +299,11 @@ func (p *XPod) Stats() *runvtypes.PodStats {
299299
p.resourceLock.Lock()
300300
if p.sandbox == nil {
301301
ch <- nil
302+
} else {
303+
go func(sb *hypervisor.Vm) {
304+
ch <- sb.Stats()
305+
}(p.sandbox)
302306
}
303-
go func(sb *hypervisor.Vm) {
304-
ch <- sb.Stats()
305-
}(p.sandbox)
306307
p.resourceLock.Unlock()
307308

308309
return <-ch

0 commit comments

Comments
 (0)