Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: provide default message content to avoid nil pointer dereference #1164

Merged
merged 1 commit into from
Nov 26, 2024

Conversation

MegaGrindStone
Copy link
Contributor

In the current version, if user is executing pattern without input, eg fabric --pattern summarize_git_diff, the program will panic with this error:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0xe22330]

goroutine 1 [running]:
github.com/danielmiessler/fabric/core.(*Chatter).BuildSession(0xc0004e43c0, 0xc00051e060, 0x0)
        /home/gs/go/pkg/mod/github.com/danielmiessler/[email protected]/core/chatter.go:116 +0x3b0
github.com/danielmiessler/fabric/core.(*Chatter).Send(0xc0004e43c0, 0xc00051e060, 0xc0003f00a0)
        /home/gs/go/pkg/mod/github.com/danielmiessler/[email protected]/core/chatter.go:30 +0x69
github.com/danielmiessler/fabric/cli.Cli({0x129b59d, 0x8})
        /home/gs/go/pkg/mod/github.com/danielmiessler/[email protected]/cli/cli.go:230 +0x7fc
main.main()
        /home/gs/go/pkg/mod/github.com/danielmiessler/[email protected]/main.go:12 +0x25

This PR address that issue by giving an empty input, or messageContent if request.Message is nil.

@eugeis eugeis merged commit be998ff into danielmiessler:main Nov 26, 2024
1 check passed
@MegaGrindStone MegaGrindStone deleted the fix-nil-pointer-message branch November 26, 2024 22:56
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.

2 participants