From 5772588c29c906a7011ab6346aafcdf6e4a7f9d8 Mon Sep 17 00:00:00 2001 From: Audrius Butkevicius Date: Tue, 9 Sep 2014 23:56:44 +0100 Subject: [PATCH] Check if global discovery was actually started before trying to stop it (fixes #653) --- discover/discover.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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 {