You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi @rzajac, do you have an example that triggers a panic ? I think that if f is nil than v will be nil as well, and therefore the closure will return always "null" value, so f(v.Elem()) statement will not be reached
I tried to trigger the case you mentionned but I was not able to
func TestNilPointerDeference(t *testing.T) {
type C struct {
R int `schema:"R"`
}
type B struct {
C *C `schema:"C"`
}
b := B{C: (*C)(nil)}
encoder := NewEncoder()
vals := url.Values{}
if err := encoder.Encode(b, vals); err != nil {
t.Fatalf(err.Error())
}
}
schema/encoder.go
Lines 167 to 173 in 8285576
The
f
should be checked fornil
before it is used in closure.The text was updated successfully, but these errors were encountered: