emersion / go-webdav

A Go library for WebDAV, CalDAV and CardDAV

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

nil check for multiGet pointless?

mrusme opened this issue · comments

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.