Skip to content

Commit d55de5d

Browse files
committed
cgroup.go: avoid panic on nil interface
Signed-off-by: linrl3 <linrunlong@bytedance.com>
1 parent ddda8a1 commit d55de5d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

cgroup.go

+3
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,9 @@ func (c *cgroup) processes(subsystem Name, recursive bool, pType procType) ([]Pr
327327
if err != nil {
328328
return nil, err
329329
}
330+
if s == nil {
331+
return nil, fmt.Errorf("cgroups: %s doesn't exist in %s subsystem", sp, subsystem)
332+
}
330333
path := s.(pather).Path(sp)
331334
var processes []Process
332335
err = filepath.Walk(path, func(p string, info os.FileInfo, err error) error {

0 commit comments

Comments
 (0)