Skip to content

Commit 6bf56dc

Browse files
aledbfroboquat
authored andcommitted
[workspacekit] Fix empty JSON deserialization error
1 parent 6fd06ff commit 6bf56dc

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

components/workspacekit/cmd/rings.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -834,11 +834,14 @@ var ring2Cmd = &cobra.Command{
834834
Max uint64 `json:"hardLimit"`
835835
}
836836

837-
rLimitValue := os.Getenv("GITPOD_RLIMIT_CORE")
838837
var rLimitCore fakeRlimit
839-
err = json.Unmarshal([]byte(rLimitValue), &rLimitCore)
840-
if err != nil {
841-
log.WithError(err).WithField("data", rLimitValue).Error("cannot deserialize GITPOD_RLIMIT_CORE")
838+
839+
rLimitValue := os.Getenv("GITPOD_RLIMIT_CORE")
840+
if len(rLimitValue) != 0 {
841+
err = json.Unmarshal([]byte(rLimitValue), &rLimitCore)
842+
if err != nil {
843+
log.WithError(err).WithField("data", rLimitValue).Error("cannot deserialize GITPOD_RLIMIT_CORE")
844+
}
842845
}
843846

844847
// we either set a limit or explicitly disable core dumps by setting 0 as values

0 commit comments

Comments
 (0)