Skip to content

Commit 4b357b2

Browse files
committed
[local-app] fix nil deref for stopping/stopped ws
1 parent dd0826c commit 4b357b2

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

components/local-app/pkg/bastion/bastion.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,10 @@ func (b *Bastion) fullUpdate(uchan chan<- *gitpod.WorkspaceInstance) {
142142
func (b *Bastion) acceptUpdates(updates chan *gitpod.WorkspaceInstance) {
143143
for u := range updates {
144144
ws, ok := b.workspaces[u.ID]
145-
if !ok && u.Status.Phase != "stopping" {
145+
if !ok {
146+
if u.Status.Phase == "stopping" || u.Status.Phase == "stopped" {
147+
continue
148+
}
146149
ctx, cancel := context.WithCancel(b.ctx)
147150
ws = &Workspace{
148151
WorkspaceID: u.WorkspaceID,
@@ -179,11 +182,11 @@ func (b *Bastion) acceptUpdates(updates chan *gitpod.WorkspaceInstance) {
179182
}
180183
}
181184

182-
case "stopping":
185+
case "stopping", "stopped":
183186
ws.cancel()
184187
delete(b.workspaces, ws.WorkspaceID)
185188
b.Callbacks.InstanceUpdate(ws)
186-
return
189+
continue
187190
}
188191

189192
b.workspaces[u.ID] = ws

0 commit comments

Comments
 (0)