From 409556604e26cba58c9aeb2a60c0221e42042edc Mon Sep 17 00:00:00 2001 From: BroodjeAap Date: Sat, 11 Jul 2020 12:59:47 +0000 Subject: [PATCH] fixed a bug in first start where CurrentColor was IMRead when it didn't exist yet --- main.go | 3 +++ stream.go | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/main.go b/main.go index c5579fe..a2de7ce 100755 --- a/main.go +++ b/main.go @@ -57,6 +57,9 @@ func (server Server) stream(w http.ResponseWriter, r *http.Request) { return } + if !stream.CurrentColorInstantPathExists() { + return + } mat := stream.IMReadCurrentColor() jpg, err := gocv.IMEncode(".jpg", mat) diff --git a/stream.go b/stream.go index 2c48de3..b12b5b8 100755 --- a/stream.go +++ b/stream.go @@ -17,10 +17,10 @@ import ( // Stream Unexported type Stream struct { - URL string `json:"url"` - Base64 string `json:"base64"` - Interval int `json:"interval"` - FileLock sync.Mutex + URL string `json:"url"` + Base64 string `json:"base64"` + Interval int `json:"interval"` + FileLock sync.Mutex `json:"lock"` } // NewStream creates a new Stream Object