diff --git a/discover/discover.go b/discover/discover.go index 9434aa66f..d508a7f08 100644 --- a/discover/discover.go +++ b/discover/discover.go @@ -108,8 +108,10 @@ func (d *Discoverer) StartGlobal(server string, extPort uint16) { } func (d *Discoverer) StopGlobal() { - close(d.stopGlobal) - d.globalWG.Wait() + if d.stopGlobal != nil { + close(d.stopGlobal) + d.globalWG.Wait() + } } func (d *Discoverer) ExtAnnounceOK() bool {