diff --git a/device/alsa/alsa.go b/device/alsa/alsa.go index 9a6801ac..90002589 100644 --- a/device/alsa/alsa.go +++ b/device/alsa/alsa.go @@ -177,7 +177,7 @@ func (d *ALSA) Setup(c config.Config) error { d.mode = paused go d.input() - if errs != nil { + if len(errs) != 0 { return errs } return nil diff --git a/device/device.go b/device/device.go index 96eb9394..10ebf534 100644 --- a/device/device.go +++ b/device/device.go @@ -68,5 +68,8 @@ type AVDevice interface { type MultiError []error func (me MultiError) Error() string { + if len(me) == 0 { + panic("device: invalid use of MultiError") + } return fmt.Sprintf("%v", []error(me)) } diff --git a/device/geovision/geovision.go b/device/geovision/geovision.go index d12ae8bc..7774e55b 100644 --- a/device/geovision/geovision.go +++ b/device/geovision/geovision.go @@ -203,7 +203,10 @@ func (g *GeoVision) Set(c avconfig.Config) error { const setupDelay = 5 * time.Second time.Sleep(setupDelay) - return errs + if len(errs) != 0 { + return errs + } + return nil } // Start uses an RTSP client to communicate with the GeoVision RTSP server and diff --git a/device/raspistill/raspistill.go b/device/raspistill/raspistill.go index 5c74553a..b5025601 100644 --- a/device/raspistill/raspistill.go +++ b/device/raspistill/raspistill.go @@ -135,5 +135,8 @@ func (r *Raspistill) Set(c config.Config) error { } r.cfg = c - return errs + if len(errs) != 0 { + return errs + } + return nil } diff --git a/device/raspivid/raspivid.go b/device/raspivid/raspivid.go index 08149755..85d58af3 100644 --- a/device/raspivid/raspivid.go +++ b/device/raspivid/raspivid.go @@ -239,7 +239,10 @@ func (r *Raspivid) Set(c config.Config) error { } r.cfg = c - return errs + if len(errs) != 0 { + return errs + } + return nil } func goodAWBGains(g string) bool { diff --git a/device/webcam/webcam.go b/device/webcam/webcam.go index 22472702..be451bb6 100644 --- a/device/webcam/webcam.go +++ b/device/webcam/webcam.go @@ -115,7 +115,10 @@ func (w *Webcam) Set(c config.Config) error { c.Bitrate = defaultBitrate } w.cfg = c - return errs + if len(errs) != 0 { + return errs + } + return nil } // Start will build the required arguments for ffmpeg and then execute the