From 4cf8896a3f081a039b5c2717e6aafd8694fb6d95 Mon Sep 17 00:00:00 2001 From: ryzendigo Date: Tue, 17 Mar 2026 06:56:22 +0800 Subject: [PATCH] fix: move null check before frame.shape access in latest_frame frame.shape is accessed on line 198 but the null check for frame doesn't happen until line 201. If the error image file is missing from disk, frame is None and accessing .shape raises AttributeError. Move the null check above the shape access. --- frigate/api/media.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frigate/api/media.py b/frigate/api/media.py index 903cf60c0..5c4ed1b0b 100644 --- a/frigate/api/media.py +++ b/frigate/api/media.py @@ -195,15 +195,15 @@ async def latest_frame( frame = request.app.camera_error_image - height = int(params.height or str(frame.shape[0])) - width = int(height * frame.shape[1] / frame.shape[0]) - if frame is None: return JSONResponse( content={"success": False, "message": "Unable to get valid frame"}, status_code=500, ) + height = int(params.height or str(frame.shape[0])) + width = int(height * frame.shape[1] / frame.shape[0]) + if height < 1 or width < 1: return JSONResponse( content="Invalid height / width requested :: {} / {}".format(