Check nil on Stop

Co-authored-by: hakansa <43675540+hakansa@users.noreply.github.com>
This commit is contained in:
Viktor Liu
2025-06-02 12:14:17 +02:00
committed by GitHub
parent dfe7f91ddd
commit db9facf9cb

View File

@@ -489,6 +489,9 @@ func (w *Watcher) Stop() {
w.cancel() w.cancel()
if w.currentChosen == nil {
return
}
if err := w.removeAllowedIPs(w.currentChosen, reasonShutdown); err != nil { if err := w.removeAllowedIPs(w.currentChosen, reasonShutdown); err != nil {
log.Errorf("Failed to remove routes for [%v]: %v", w.handler, err) log.Errorf("Failed to remove routes for [%v]: %v", w.handler, err)
} }