mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-03-17 21:58:22 +03:00
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.
This commit is contained in:
parent
722ef6a1fe
commit
4cf8896a3f
@ -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(
|
||||
|
||||
Loading…
Reference in New Issue
Block a user