From 1785c69e1b31956cd12e7ddcd7523ce1d0db0b92 Mon Sep 17 00:00:00 2001 From: Blake Blackshear Date: Tue, 19 Jan 2021 21:59:35 -0600 Subject: [PATCH] handle exception when frame isnt in cache --- frigate/object_processing.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/frigate/object_processing.py b/frigate/object_processing.py index 71c5fb814..1c125c87d 100644 --- a/frigate/object_processing.py +++ b/frigate/object_processing.py @@ -183,7 +183,11 @@ class TrackedObject(): if self.thumbnail_data is None: return None - best_frame = cv2.cvtColor(self.frame_cache[self.thumbnail_data['frame_time']], cv2.COLOR_YUV2BGR_I420) + try: + best_frame = cv2.cvtColor(self.frame_cache[self.thumbnail_data['frame_time']], cv2.COLOR_YUV2BGR_I420) + except KeyError: + logger.warning(f"Unable to create jpg because frame {self.thumbnail_data['frame_time']} is not in the cache") + return None if bounding_box: thickness = 2