Fix router panic for nil watcher

This commit is contained in:
Asim Aslam 2020-02-10 15:38:41 +00:00
parent 4401c12e6c
commit 8ea84ac3eb

View File

@ -530,7 +530,9 @@ func (r *router) Start() error {
for { for {
select { select {
case <-r.exit: case <-r.exit:
if w != nil {
w.Stop() w.Stop()
}
return return
default: default:
if w == nil { if w == nil {
@ -547,10 +549,12 @@ func (r *router) Start() error {
time.Sleep(time.Second) time.Sleep(time.Second)
} }
if w != nil {
w.Stop() w.Stop()
w = nil w = nil
} }
} }
}
}() }()
r.running = true r.running = true