From f02ce3c0d21f81679fe603a0a3320409d463efc1 Mon Sep 17 00:00:00 2001 From: Jieyu Tian Date: Fri, 18 Oct 2024 17:52:33 +0000 Subject: [PATCH] fix CreateBlueprintDisplayMetadata function when there is no existing data --- cli/bpmetadata/cmd.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cli/bpmetadata/cmd.go b/cli/bpmetadata/cmd.go index ab43dab1625..6375f86b23d 100644 --- a/cli/bpmetadata/cmd.go +++ b/cli/bpmetadata/cmd.go @@ -308,7 +308,12 @@ func CreateBlueprintDisplayMetadata(bpPath string, bpDisp, bpCore *BlueprintMeta bpDisp.Spec.Info.Source = bpCore.Spec.Info.Source buildUIInputFromVariables(bpCore.Spec.Interfaces.Variables, bpDisp.Spec.Ui.Input) - existingInput := proto.Clone(bpCore.Spec.Ui.Input).(*BlueprintUIInput) + existingInput := func() *BlueprintUIInput { + if bpCore.Spec.Ui != nil && bpCore.Spec.Ui.Input != nil { + return proto.Clone(bpCore.Spec.Ui.Input).(*BlueprintUIInput) + } + return &BlueprintUIInput{} + }() // Merge existing data (if any) into the newly generated UI Input mergeExistingAltDefaults(bpDisp.Spec.Ui.Input, existingInput)