Skip to content

Commit 90010ec

Browse files
authored
Merge pull request #207 from linrl3/topic/nil-interface-bug
cgroup.go: avoid panic on nil interface
2 parents ddda8a1 + d55de5d commit 90010ec

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)