Skip to content

Commit

Permalink
rpk: check for empty profiles in license check.
Browse files Browse the repository at this point in the history
This is to avoid a panic in the edge case when the
user has a nameless profile (corrupted file)
  • Loading branch information
r-vasquez committed Oct 16, 2024
1 parent df9943e commit 819e546
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/go/rpk/pkg/adminapi/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,11 @@ func licenseFeatureChecks(ctx context.Context, fs afero.Fs, cl *rpadmin.AdminAPI
}
if exists && y != nil {
actProfile := y.Profile(p.Name)
actProfile.LicenseCheck = licenseCheck
if err := y.Write(fs); err != nil {
zap.L().Sugar().Warnf("unable to save licensed enterprise features check cache to profile: %v", err)
if actProfile != nil {
actProfile.LicenseCheck = licenseCheck
if err := y.Write(fs); err != nil {
zap.L().Sugar().Warnf("unable to save licensed enterprise features check cache to profile: %v", err)
}
}
}
}
Expand Down

0 comments on commit 819e546

Please sign in to comment.