fix: panic on deleted template (#6553)

This commit is contained in:
Marcin Tojek
2023-03-10 12:26:11 +01:00
committed by GitHub
parent 6023264a81
commit 90901ca129

View File

@ -256,6 +256,11 @@ func (api *API) workspaceByOwnerAndName(rw http.ResponseWriter, r *http.Request)
return
}
if len(data.builds) == 0 || len(data.templates) == 0 {
httpapi.ResourceNotFound(rw)
return
}
httpapi.Write(ctx, rw, http.StatusOK, convertWorkspace(
workspace,
data.builds[0],