Skip to content

Conversation

tjy9206
Copy link
Contributor

@tjy9206 tjy9206 commented Oct 18, 2024

I encountered this error when trying to generate metadata.display.yaml (running cft with -d flag):

INFO[10-18|17:39:03] Sort variables by the original input order. 
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x28 pc=0x1454fc5]

goroutine 1 [running]:
github.com/GoogleCloudPlatform/cloud-foundation-toolkit/cli/bpmetadata.CreateBlueprintDisplayMetadata({0xc000062c30?, 0x46?}, 0xc000ec4e40, 0xc000680cc0)
        /usr/local/google/home/jieyutian/cloud-foundation-toolkit/cli/bpmetadata/cmd.go:311 +0x365
github.com/GoogleCloudPlatform/cloud-foundation-toolkit/cli/bpmetadata.generateMetadataForBpPath({0xc000062c30, 0x46})
        /usr/local/google/home/jieyutian/cloud-foundation-toolkit/cli/bpmetadata/cmd.go:179 +0x205
github.com/GoogleCloudPlatform/cloud-foundation-toolkit/cli/bpmetadata.generate(0x49ffa00?, {0xc000680c60?, 0x4?, 0x2b7fbf1?})
        /usr/local/google/home/jieyutian/cloud-foundation-toolkit/cli/bpmetadata/cmd.go:125 +0x607
github.com/spf13/cobra.(*Command).execute(0x49ffa00, {0xc000680c00, 0x6, 0x6})
        /usr/local/google/home/jieyutian/go/pkg/mod/github.com/spf13/[email protected]/command.go:985 +0xaaa
github.com/spf13/cobra.(*Command).ExecuteC(0x49fe8c0)
        /usr/local/google/home/jieyutian/go/pkg/mod/github.com/spf13/[email protected]/command.go:1117 +0x3ff
github.com/spf13/cobra.(*Command).Execute(...)
        /usr/local/google/home/jieyutian/go/pkg/mod/github.com/spf13/[email protected]/command.go:1041
github.com/GoogleCloudPlatform/cloud-foundation-toolkit/cli/cmd.Execute()
        /usr/local/google/home/jieyutian/cloud-foundation-toolkit/cli/cmd/root.go:86 +0x1a
main.main()
        /usr/local/google/home/jieyutian/cloud-foundation-toolkit/cli/main.go:6 +0xf

This is because we are not checking if bpCore.Spec.Ui.Input has any null pointer references in existingInput := proto.Clone(bpCore.Spec.Ui.Input).(*BlueprintUIInput). Fixing in this PR.

@tjy9206 tjy9206 requested review from a team and q2w as code owners October 18, 2024 17:56
Copy link
Contributor

@qz267 qz267 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks @tjy9206

@q2w q2w enabled auto-merge (squash) October 23, 2024 14:19
@q2w q2w merged commit 8557837 into GoogleCloudPlatform:master Oct 23, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants