Commit ed51058e authored by opalmer's avatar opalmer Committed by Sander van Harmelen

fix panic when []OptionFunc contains nil (#263)

NewRequest() can potentially be called with a
nil value present in []OptionFunc. For example
this code would trigger a panic prior to this
commit:

  _, _, err := git.Users.ModifyUser(event.UserId, options, nil)
parent f1f4b500
...@@ -356,6 +356,10 @@ func (c *Client) NewRequest(method, path string, opt interface{}, options []Opti ...@@ -356,6 +356,10 @@ func (c *Client) NewRequest(method, path string, opt interface{}, options []Opti
} }
for _, fn := range options { for _, fn := range options {
if fn == nil {
continue
}
if err := fn(req); err != nil { if err := fn(req); err != nil {
return nil, err return nil, err
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment