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

Fixing nil pointer dereference for optional fields #622

Merged
merged 3 commits into from
Aug 14, 2019

Conversation

tejaswiagarwal
Copy link
Contributor

Optional fields should check before dereferencing the header value

@argouber argouber self-requested a review August 13, 2019 22:30
@@ -802,7 +802,8 @@ func (ms *MethodSpec) setClientRequestHeaderFields(
// Note header values are always string
headerNameValuePair = "headers[%q]= string(r%s)"
} else {
headerNameValuePair = "headers[%q]= string(*r%s)"
headerNameValuePair = "if r != nil {" +
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure if this will prevent the panic. I think you need *r%s != nil

@tejaswiagarwal tejaswiagarwal merged commit d9eb102 into master Aug 14, 2019
@ChuntaoLu ChuntaoLu deleted the fix_nil_pointer_dereference branch July 8, 2020 17:24
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.

3 participants