Skip to content

Commit d1bd251

Browse files
committed
fix: panic on deleted template
1 parent 6023264 commit d1bd251

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

coderd/workspaces.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,11 @@ func (api *API) workspaceByOwnerAndName(rw http.ResponseWriter, r *http.Request)
256256
return
257257
}
258258

259+
if len(data.builds) == 0 || len(data.templates) == 0 {
260+
httpapi.ResourceNotFound(rw)
261+
return
262+
}
263+
259264
httpapi.Write(ctx, rw, http.StatusOK, convertWorkspace(
260265
workspace,
261266
data.builds[0],

0 commit comments

Comments
 (0)