Skip to content

Commit d364e86

Browse files
committed
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 d364e86

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-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
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package codersdk
2+
3+
type Region struct {
4+
ID string `json:"id" format:"uuid" table:"id"`
5+
}
6+
type WorkspaceProxy struct {
7+
// Extends Region with extra information
8+
Region `table:"region,recursive_inline"`
9+
DerpOnly bool `json:"derp_only" table:"derp_only"`
10+
}
11+
12+
type RegionTypes interface {
13+
Region | WorkspaceProxy
14+
}
15+
16+
type RegionsResponse[R RegionTypes] struct {
17+
Regions []R `json:"regions"`
18+
}

scripts/apitypings/testdata/genericunion/genericunion.ts

Whitespace-only changes.

0 commit comments

Comments
 (0)