Skip to content

Commit

Permalink
fix bug handling empty addresses
Browse files Browse the repository at this point in the history
  • Loading branch information
jcodybaker committed Feb 18, 2024
1 parent 7855b79 commit db3e339
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/discovery/mdns.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@ func sourceIsMDNS(dev *Device) {
}

func (d *Discoverer) mdnsSEAddr(se *mdns.ServiceEntry) net.IP {
if d.preferIPVersion != "6" && !se.AddrV4.IsUnspecified() {
if d.preferIPVersion != "6" && se.AddrV4 != nil && !se.AddrV4.IsUnspecified() {
return se.AddrV4
} else if d.preferIPVersion != "4" && !se.AddrV6.IsUnspecified() {
} else if d.preferIPVersion != "4" && se.AddrV6 != nil && !se.AddrV6.IsUnspecified() {
return se.AddrV6
}
return nil
Expand Down

0 comments on commit db3e339

Please sign in to comment.