From d5073ed80586e21b6a2806a10721f29802729d3b Mon Sep 17 00:00:00 2001 From: Rokibul Hasan Date: Sat, 26 Oct 2024 08:49:29 +0600 Subject: [PATCH] Fix panic issue Signed-off-by: Rokibul Hasan --- pkg/cmd/get/hubinfo/exec.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/pkg/cmd/get/hubinfo/exec.go b/pkg/cmd/get/hubinfo/exec.go index eab93388..4e7b14a3 100644 --- a/pkg/cmd/get/hubinfo/exec.go +++ b/pkg/cmd/get/hubinfo/exec.go @@ -118,10 +118,9 @@ func (o *Options) printComponents() error { } o.printer.Write(printer.LEVEL_0, "Components:\n") - if check.IsFeatureEnabled(cmgr.Spec.AddOnManagerConfiguration.FeatureGates, string(feature.AddonManagement)) { - if err := o.printAddOnManager(cmgr); err != nil { - return err - } + + if err := o.printAddOnManager(cmgr); err != nil { + return err } if err := o.printRegistration(cmgr); err != nil { return err @@ -150,7 +149,7 @@ func (o *Options) printRegistration(cmgr *v1.ClusterManager) error { func (o *Options) printWork(cmgr *v1.ClusterManager) error { o.printer.Write(printer.LEVEL_1, "Work:\n") - if check.IsFeatureEnabled(cmgr.Spec.WorkConfiguration.FeatureGates, string(feature.ManifestWorkReplicaSet)) { + if cmgr.Spec.WorkConfiguration != nil && check.IsFeatureEnabled(cmgr.Spec.WorkConfiguration.FeatureGates, string(feature.ManifestWorkReplicaSet)) { err := printer.PrintComponentsDeploy(o.printer, o.kubeClient, cmgr.Status.RelatedResources, componentNameWorkController) if err != nil { return err