mirror of
https://github.com/octoleo/syncthing.git
synced 2024-12-22 19:08:58 +00:00
lib/stun: Prevent nil deref when naming service (#7872)
This commit is contained in:
parent
50aacdf1f0
commit
e61091d240
@ -107,8 +107,14 @@ func New(cfg config.Wrapper, subscriber Subscriber, conn *net.UDPConn) (*Service
|
||||
client.SetSoftwareName("") // Explicitly unset this, seems to freak some servers out.
|
||||
|
||||
// Return the service and the other conn to the client
|
||||
name := "Stun@"
|
||||
if local := conn.LocalAddr(); local != nil {
|
||||
name += local.Network() + "://" + local.String()
|
||||
} else {
|
||||
name += "unknown"
|
||||
}
|
||||
s := &Service{
|
||||
name: "Stun@" + conn.LocalAddr().Network() + "://" + conn.LocalAddr().String(),
|
||||
name: name,
|
||||
|
||||
cfg: cfg,
|
||||
subscriber: subscriber,
|
||||
|
Loading…
Reference in New Issue
Block a user