Skip to content

Commit 8221544

Browse files
authored
chore: check if process is nil (#11090)
* chore: check if process is nil We check if process is nil in the ports_supported file. Just matching that defensive check, not sure if it can be nil.
1 parent dbbf8ac commit 8221544

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

agent/agentssh/portinspection_supported.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ func getListeningPortProcessCmdline(port uint32) (string, error) {
2020
if len(tabs) == 0 {
2121
return "", nil
2222
}
23+
24+
// Defensive check.
25+
if tabs[0].Process == nil {
26+
return "", nil
27+
}
28+
2329
// The process name provided by go-netstat does not include the full command
2430
// line so grab that instead.
2531
pid := tabs[0].Process.Pid

0 commit comments

Comments
 (0)