From 1c3ca2422e14205063b836f6f17f17e2927f85dd Mon Sep 17 00:00:00 2001 From: Manuel Alejandro de Brito Fontes Date: Wed, 21 Sep 2022 20:24:22 -0300 Subject: [PATCH] [workspacekit] Fix empty JSON deserialization error --- components/workspacekit/cmd/rings.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/components/workspacekit/cmd/rings.go b/components/workspacekit/cmd/rings.go index ad39aa9f756282..d5249043b8e1b2 100644 --- a/components/workspacekit/cmd/rings.go +++ b/components/workspacekit/cmd/rings.go @@ -834,11 +834,14 @@ var ring2Cmd = &cobra.Command{ Max uint64 `json:"hardLimit"` } - rLimitValue := os.Getenv("GITPOD_RLIMIT_CORE") var rLimitCore fakeRlimit - err = json.Unmarshal([]byte(rLimitValue), &rLimitCore) - if err != nil { - log.WithError(err).WithField("data", rLimitValue).Error("cannot deserialize GITPOD_RLIMIT_CORE") + + rLimitValue := os.Getenv("GITPOD_RLIMIT_CORE") + if len(rLimitValue) != 0 { + err = json.Unmarshal([]byte(rLimitValue), &rLimitCore) + if err != nil { + log.WithError(err).WithField("data", rLimitValue).Error("cannot deserialize GITPOD_RLIMIT_CORE") + } } // we either set a limit or explicitly disable core dumps by setting 0 as values