From 54eafe9d0aa9fe31c0b313b8632df762720cfbac Mon Sep 17 00:00:00 2001 From: Alex X Date: Sun, 18 Jan 2026 15:48:56 +0300 Subject: [PATCH] Skip snapshot caching in case of error --- internal/mjpeg/{init.go => mjpeg.go} | 3 +++ 1 file changed, 3 insertions(+) rename internal/mjpeg/{init.go => mjpeg.go} (99%) diff --git a/internal/mjpeg/init.go b/internal/mjpeg/mjpeg.go similarity index 99% rename from internal/mjpeg/init.go rename to internal/mjpeg/mjpeg.go index b2f3e1f4..e9f973aa 100644 --- a/internal/mjpeg/init.go +++ b/internal/mjpeg/mjpeg.go @@ -60,6 +60,9 @@ func handlerKeyframe(w http.ResponseWriter, r *http.Request) { } defer func() { + if b == nil { + return + } entry = cacheEntry{payload: b, timestamp: time.Now()} cacheMu.Lock() if cache == nil {