Unbreak running without a captive portal configuration file

This commit is contained in:
Frank Denis 2020-08-04 00:50:59 +02:00
parent 5843e49188
commit 60d4c98f31
3 changed files with 7 additions and 3 deletions

View File

@ -22,7 +22,7 @@ type CaptivePortalHandler struct {
cancelChannels []chan struct{}
}
func (captivePortalHandler *CaptivePortalHandler) Stop() {
func (captivePortalHandler *CaptivePortalHandler) Stop() {
for _, cancelChannel := range captivePortalHandler.cancelChannels {
cancelChannel <- struct{}{}
_ = <-cancelChannel

View File

@ -14,7 +14,9 @@ func NetProbe(proxy *Proxy, address string, timeout int) error {
return nil
}
if captivePortalHandler, err := ColdStart(proxy); err == nil {
defer captivePortalHandler.Stop()
if captivePortalHandler != nil {
defer captivePortalHandler.Stop()
}
} else {
dlog.Critical(err)
}

View File

@ -12,7 +12,9 @@ func NetProbe(proxy *Proxy, address string, timeout int) error {
return nil
}
if captivePortalHandler, err := ColdStart(proxy); err == nil {
defer captivePortalHandler.Stop()
if captivePortalHandler != nil {
defer captivePortalHandler.Stop()
}
} else {
dlog.Critical(err)
}