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:
ryzendigo 2026-03-16 14:47:55 +08:00
parent 5a214eb0d1
commit f09b742321

View File

@ -451,13 +451,13 @@ class EmbeddingMaintainer(threading.Thread):
return
# Create our own thumbnail based on the bounding box and the frame time
yuv_frame = None
try:
yuv_frame = self.frame_manager.get(
frame_name, camera_config.frame_shape_yuv
)
except FileNotFoundError:
logger.debug(f"Frame {frame_name} not found for camera {camera}")
pass
if yuv_frame is None:
logger.debug(
@ -672,6 +672,7 @@ class EmbeddingMaintainer(threading.Thread):
# no active features that use this data
return
yuv_frame = None
try:
yuv_frame = self.frame_manager.get(
frame_name, camera_config.frame_shape_yuv