mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-03-23 08:38:22 +03:00
fix: unbound yuv_frame after FileNotFoundError in embeddings
Both _process_updates() and _process_frame_updates() catch FileNotFoundError from frame_manager.get() but don't assign yuv_frame before the try block. If the exception fires, yuv_frame is never assigned and the subsequent 'if yuv_frame is None' check raises UnboundLocalError instead of gracefully returning. Initialize yuv_frame = None before each try block.
This commit is contained in:
parent
5a214eb0d1
commit
f09b742321
@ -451,13 +451,13 @@ class EmbeddingMaintainer(threading.Thread):
|
|||||||
return
|
return
|
||||||
|
|
||||||
# Create our own thumbnail based on the bounding box and the frame time
|
# Create our own thumbnail based on the bounding box and the frame time
|
||||||
|
yuv_frame = None
|
||||||
try:
|
try:
|
||||||
yuv_frame = self.frame_manager.get(
|
yuv_frame = self.frame_manager.get(
|
||||||
frame_name, camera_config.frame_shape_yuv
|
frame_name, camera_config.frame_shape_yuv
|
||||||
)
|
)
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
logger.debug(f"Frame {frame_name} not found for camera {camera}")
|
logger.debug(f"Frame {frame_name} not found for camera {camera}")
|
||||||
pass
|
|
||||||
|
|
||||||
if yuv_frame is None:
|
if yuv_frame is None:
|
||||||
logger.debug(
|
logger.debug(
|
||||||
@ -672,6 +672,7 @@ class EmbeddingMaintainer(threading.Thread):
|
|||||||
# no active features that use this data
|
# no active features that use this data
|
||||||
return
|
return
|
||||||
|
|
||||||
|
yuv_frame = None
|
||||||
try:
|
try:
|
||||||
yuv_frame = self.frame_manager.get(
|
yuv_frame = self.frame_manager.get(
|
||||||
frame_name, camera_config.frame_shape_yuv
|
frame_name, camera_config.frame_shape_yuv
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user