Skip to content

fix: handle nil pointer for provider options in GenerativeProvider - #499

Open
databyjp wants to merge 1 commit into
v6from
bugfix/20261026-openai-generative-nil-pointer
Open

databyjp wants to merge 1 commit into
v6from
bugfix/20261026-openai-generative-nil-pointer

Conversation

@databyjp

Copy link
Copy Markdown

Address #498

@databyjp
databyjp requested a review from bevzzz October 26, 2026 19:25

@orca-security-eu orca-security-eu Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Orca Security Scan Summary

Status Check Issues by priority
Passed Passed Secrets high 0   medium 0   low 0   info 0 View in Orca

Comment thread modules/openai/module.go
Comment on lines +93 to +96
p := g.Provider
if p == nil {
p = new(Provider)
}

@bevzzz bevzzz Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

question: should we just make the embedded Provider field a value and not a pointer? Then it's automatically initialized to zero and there'll be no need to do the if g.Provider == nil check.

type Generative struct {
--  *Provider `json:"-"`
++  Provider  `json:"-"`
}

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Wouldn't that be a breaking change?

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