mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
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.
This commit is contained in:
@@ -20,6 +20,12 @@ func getListeningPortProcessCmdline(port uint32) (string, error) {
|
||||
if len(tabs) == 0 {
|
||||
return "", nil
|
||||
}
|
||||
|
||||
// Defensive check.
|
||||
if tabs[0].Process == nil {
|
||||
return "", nil
|
||||
}
|
||||
|
||||
// The process name provided by go-netstat does not include the full command
|
||||
// line so grab that instead.
|
||||
pid := tabs[0].Process.Pid
|
||||
|
||||
Reference in New Issue
Block a user