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

nil check for multiGet pointless? #92

Closed
mrusme opened this issue May 29, 2022 · 0 comments
Closed

nil check for multiGet pointless? #92

mrusme opened this issue May 29, 2022 · 0 comments

Comments

@mrusme
Copy link

mrusme commented May 29, 2022

I'm looking at the following code and I'm wondering whether it makes sense:

go-webdav/carddav/client.go

Lines 308 to 315 in 13fa812

propReq, err := encodeAddressPropReq(&multiGet.DataRequest)
if err != nil {
return nil, err
}
addressbookMultiget := addressbookMultiget{Prop: propReq}
if multiGet == nil || len(multiGet.Paths) == 0 {

From what I see multiGet cannot be nil, because &multiGet.DataRequest would throw an invalid memory address / nil pointer error. Hence the check if multiGet == nil seems kind of pointless here.

Either that check should happen earlier or not at all, imho.

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

No branches or pull requests

1 participant